"$wp_query->post_count" not working when tweaked
-
ok so I’m trying to tweak a parameter in my loop, here is the loop which works fine:
<?php /* Start the Loop */ ?> <?php $count = 0; $output = min(0, $wp_query->post_count-1); ?> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'loop', get_post_format() ); ?> <?php if ($count == $output) : ?> <?php if (($wp_query->post_count) <= 0) : ?> <div class="posts_0_area_spacer"> </div> <?php endif; ?> <?php if (($wp_query->post_count) <= 1) : ?> <div class="posts_1_area_spacer"> </div> <?php endif; ?> <?php if (($wp_query->post_count) <= 2) : ?> <div class="posts_2_area_spacer"> </div> <?php endif; ?> <?php if (($wp_query->post_count) <= 3) : ?> <div class="posts_3_area_spacer"> </div> <?php endif; ?> <?php endif; ?> <?php $count++; ?> <?php endwhile; ?>I want to tweak the ($wp_query->post_count) <= X) lines so that its just “equal to” so its not “less than or equal to” but when I remove the “<” it breaks everything, telling me there is an unexpected “=” on that line, seems odd to me that this doesn’t work?? Someone please help me out. The goal of this code in the loop is to show different divs after the posts depending on the number of posts.
please put backticks around your code in the future – mod
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘"$wp_query->post_count" not working when tweaked’ is closed to new replies.