Advertisement
Guest User

need to avoid duplicates on homepage loop

a guest
Feb 16th, 2012
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.00 KB | None | 0 0
  1. <!-- Featured is first -->
  2.         <?php $my_query = new WP_Query('category_name=featured&posts_per_page=1');
  3.           while ($my_query->have_posts()) : $my_query->the_post();
  4.           $do_not_duplicate = $post->ID; ?>
  5.             <?php
  6.                 // Get the ID of a given category
  7.                 $category_id = get_cat_ID( 'Featured' );
  8.                 // Get the URL of this category
  9.                 $category_link = get_category_link( $category_id );
  10.             ?>
  11.             <article>
  12.                 <header>
  13.                     <h1><a href="<?php echo esc_url( $category_link ); ?>">// Featured</a></h1>
  14.                 </header>
  15.                 <div class="related-thumb">
  16.                     <a href="<?php the_permalink() ?>" rel="bookmark"><?php the_post_thumbnail( 'cat-post-thumb'); ?></a>
  17.                 </div>
  18.                 <h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
  19.                 <time datetime="<?php echo the_time('j-m-Y'); ?>" pubdate><?php echo ''.get_the_time('j').' '.''.get_the_time('M').' '.get_the_time('Y').''; ?></time>
  20.                 <p><?php the_excerpt(); ?></p>
  21.             </article>
  22.         <?php endwhile; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement