Different number of posts showing in development vs production server
As noted by @s_ha_dum, I had some sticky posts. I had to use the ‘ignore_sticky_posts’ => true argument inside the WP_Query.
As noted by @s_ha_dum, I had some sticky posts. I had to use the ‘ignore_sticky_posts’ => true argument inside the WP_Query.
posts_per_page not returning correct number of posts
return wp query results in a shortcode
After giving it another look with some fresh eyes, I decided to add a third loop within Loop 2 and not have it working as desired: $media_args = array( ‘post_type’ => ‘attachment’, ‘posts_per_page’ => -1, ‘tax_query’ => array( array( ‘taxonomy’ => ‘products’, ‘field’ => ‘term_id’, ‘terms’ => $product_tag ) ) ); // Loop 1 – … Read more
Switching out echo get_comments_number($post->ID) for echo $post->comment_count did the trick. I have no idea why, that’s exactly what the get_comments_number() function does…
You need a loop within a loop – loop through a counter, and for each value, check for the existence of each key with the current counter value appended. // max custom field index $number = 40; // the counter $counter=””; // the meta keys to check for $keys = array( ‘custom_text’, ‘custom_image’, ‘custom_video’ ); … Read more
Overwriting auto-appended NOT IN query in WP_Query
I ended up doing this – works perfectly. <?php $argsb = array(‘posts_per_page’ => -1, ‘post_status’ => ‘publish’);?> <?php $blog = new WP_Query($argsb); if ( $blog->have_posts() ): ?> <section class=”blog-slider slider”> <div class=”flexslider”> <ul class=”slides”> <?php while ( $blog->have_posts() ) : $blog->the_post(); $i++;?> <?php if( $blog->current_post % 3 == 0 ) echo “\n”.'<li class=”slide”>’.”\n”; ?> <article … Read more
When you set up your query, do it this way ( I believe you were missing the ‘date_query’ key ): $args = array( ‘date_query’ => array( array( ‘year’ => 2012, ‘month’ => 12, ‘day’ => 12, ), ), ‘ignore_sticky_posts’ => true, ‘post__not_in’ => get_option(‘sticky_posts’) … ); $query = new WP_Query( $args ); http://codex.wordpress.org/Class_Reference/WP_Query#Date_Parameters
How to sort a WP_Query array by post_name after an array_merge();