Monthly Archives: January 2016

php.ini – change for uploading large database

SQL ERROR: Script timeout passed, if you want to finish import, please resubmit same file and import will resume

php> php.ini

Find:
post_max_size = 8M
upload_max_filesize = 2M
max_execution_time = 30
max_input_time = 60
memory_limit = 8M

Change to:
post_max_size = 750M
upload_max_filesize = 750M
max_execution_time = 300
max_input_time = 540
memory_limit = 1000M

Refrence: http://askubuntu.com/questions/411505/script-timeout-passed-if-you-want-to-finish-import-please-resubmit-same-file-a

Advertisements

auto fill form field

name: <input id="de-name" type="text">
recomendation:	<input id="de-name" type="text">

/* auto field form field*/
jQuery(document).ready(function(){
	jQuery( "#de-name" ).keyup(function() {
		jQuery('#de-rec').val(jQuery('#de-name').val());
	});
});

count all meta values

function post_vierer(){
	global $wpdb;
	$result = $wpdb->get_results ("SELECT sum(meta_value) AS total FROM ".$wpdb->prefix."postmeta WHERE meta_key = 'post_views_count'");
	echo $result[0]->total;
}

Display
post_vierer();

Get a list of registered taxonomy

Get a list of registered taxonomy without link

 <?php
              	$terms = get_terms( 'features' );
				 if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
					 echo '<ul>';
					 foreach ( $terms as $term ) {
					   echo '<li>' . $term->name . '</li>';
						
					 }
					 echo '</ul>';
				 }
			   ?>

Get a list of registered taxonomy with link

<?php
					$args = array( 'hide_empty' => 0 );
					$terms = get_terms( 'features', $args );
					if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
						$count = count( $terms );
						$i = 0;
						$term_list = '<p class="features-archive">';
						foreach ( $terms as $term ) {
							$i++;
							$term_list .= '<a href="' . get_term_link( $term ) . '" title="' . sprintf( __( 'View all post filed under %s', 'my_localization_domain' ), $term->name ) . '">' . $term->name . '</a>';
							if ( $count != $i ) {
								$term_list .= ' , ';
							}
							else {
								$term_list .= '</p>';
							}
					}
					echo $term_list;
				}
				?>

Get a list of registered taxonomy By ID in single post page

<?php 
				  foreach((get_the_terms($post->ID, 'html-tag')) as $term)
						 {
							$term_link = get_term_link( $term );
   							// If there was an error, continue to the next term.
    							if ( is_wp_error( $term_link ) ) {
        							continue;
    							}
							echo '<a href="' . esc_url( $term_link ) . '">' . $term->name . '</a>, ','';
						}
                  ?>
%d bloggers like this: