Stop repeat posts in wordpress
-
Hello!
I am trying to stop repeating posts from a single category on a page. I am using following code but I can see first function post and second function not showing anything any idea?
<?php $showpost = new WP_query(); $showpost->query(‘showposts=1&cat=6’); ?>
<?php if ($showpost->have_posts()) : ?>
<?php while ($showpost->have_posts()) : $showpost->the_post(); $myPosts .= $post->ID . “,”; ?>
<div class=”focus”>
<h3>” title=”<?php the_title(); ?>”><?php the_title(); ?></h3>
<div style=”padding:0 0 14px 0;”></div>
<p>” title=”<?php the_title(); ?>”><?php print do_excerpt(get_the_excerpt(), $carpet[‘snippet_level2’]); ?></p>
<ul class=”etc”>
<li class=”readit”>“>Continue
<li class=”commentit”>” title=”Comments on <?php the_title(); ?>”><?php comments_number(‘0 Comments’, ‘1 comment’, ‘% comments’); ?>
<div class=”clear”></div>
</div>
<?php endwhile; ?>
<?php endif; ?><!– Second Function –>
<?php $myPosts .= “0”; add_filter(‘posts_where’, ‘post_strip’); ?>
<?php $showpost = new WP_query(); $showpost->query(‘showposts=12&cat=6’); ?>
<?php if ($showpost->have_posts()) : ?>
<?php while ($showpost->have_posts()) : $showpost->the_post(); $myPosts .= $post->ID . “,”; ?>
<div class=”box_type_a recently”>
<h3>” title=”<?php the_title(); ?>”><?php the_title(); ?></h3>
<p>” title=”<?php the_title(); ?>”><?php print do_excerpt(get_the_excerpt(), $carpet[‘snippet_level2’]); ?></p>
<ul class=”etc”>
<li class=”readit”>“>Continue
<li class=”commentit”>” title=”Comments on <?php the_title(); ?>”><?php comments_number(‘0 Comments’, ‘1 comment’, ‘% comments’); ?>
<div class=”clear”></div>
</div>
<?php endwhile; ?>
<?php endif; ?>
<?php remove_filter(‘posts_where’, ‘post_strip’); ?>
- The topic ‘Stop repeat posts in wordpress’ is closed to new replies.