Pagination is not working on custom query inside a custom home page template

Use this for pagination <?php $paged = ( get_query_var( ‘paged’ ) ) ? absint( get_query_var( ‘paged’ ) ) : 1; $mostpopular_args=array( ‘post_type’ => ‘post’, ‘orderby’ => ‘meta_value_num’, ‘meta_key’ => ‘view_count’, ‘paged’ => $paged, ‘posts_per_page’ => ’10’, ); $wp_query = new WP_Query($mostpopular_args); while ($wp_query->have_posts()): $wp_query->the_post(); get_the_title(); endwhile; global $wp_query; $big = 999999999; // need an unlikely … Read more

Cannot order by in WP_Query

Ok, the problem came from the fact I was looping on categories to get the matching post. What I had to do was to get the desired categories and use it in my $args + some adjustments. <?php // Get the parent cat thanks to the page’s cat slug $parent_cat = get_category_by_slug( $cat[1] ); $cats_args … Read more

Post Query not working after updating to 4.1

I formed this query based on this answer. I would appear this is no longer the way to do it… I reformatted the query to look like this: query_posts( array( ‘post_type’ => ‘events’, ‘showposts’ => -1, ‘order’ => ‘ASC’, ‘orderby’ => ‘meta_value_num’, ‘meta_query’ => array( ‘relation’ => ‘OR’, array( ‘key’ => ‘_ecmb_datetime’, ‘value’ => strtotime(‘today … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)