Just check $wp_query->current_post
instead of using that mod
operator.
if ($wp_query->current_post === 4) { ?>
<div class="vender_hr"></div>
<?php }
But don’t use query_posts
. Create a new WP_Query
object. What you are doing is kind-of weird. You are checking to see if there are posts, then clobbering the main query which invalidates the have_posts
check you just did, and then Looping though the post set. That really should look something more like this:
$qry = new WP_Query("posts_per_page=8&post_type=post&orderby=rand");
if ($qry->have_posts()) {
while ($qry->have_posts()) {
$qry->the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <?php echo eh_postImage(240,240,1); ?>
<?php the_title(); ?>
<?php the_content_rss('', FALSE, '', 60); ?>
</article><?php
if ($qry->current_post === 4) { ?>
<div class="vender_hr"></div><?php
}
}
}
Also, the_content_rss
has been deprecated since WpordPress 2.9. If you had debugging enabled as you should have while you are working, you’d see the notice.