wpdb Cannot Access Associative Array Data in a Count Query

You can simplify that by using $wpdb->get_var. $total = $wpdb->get_var( “SELECT COUNT( * ) AS total FROM tableA” ); echo “Total Records:” . $total; However, the code you’ve got should work– either version of it. I tested both. The only thing I notice is that the first version of the code should give you Array … Read more

Jquery script not loading on site Front page

WordPress uses jQuery noConflict wrappers so the dollar sign will not work unless it is used as an alias. Either wrap your code in: jQuery(document).ready(function($) { // Inside of this function, $() will work as an alias for jQuery() // and other libraries also using $ will not be accessible under this shortcut }); Or … Read more

Post_per_page -1 returns only half the results

As hinted by the comments I replaced the query_posts by a WP_Query query. $args=array( ‘post_type’ => ‘restaurante’, ‘posts_per_page’ => -1, ‘meta_key’ => ‘restaurante_municipio’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘ASC’); $the_query = null; $the_query = new WP_Query($args); if ( $the_query->have_posts() ) { $total_results = $the_query->found_posts; echo ‘<p><b>Restaurantes: ‘.$total_results.'</b>’; while ( $the_query->have_posts() ) { $the_query->the_post(); … .. … Read more