Revision: 19645
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 27, 2009 17:19 by gd6d
Initial Code
<?php /* Start non-duplicates */ function post_strip($where) { global $myPosts, $wpdb; $where .= " AND $wpdb->posts.ID not in($myPosts) "; return $where; } ?> <?php global $myPosts; $myPosts = ''; ?> <div> <?php $my_query = new WP_Query(); $my_query->query('showposts=5'); if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post(); ?> <?php $myPosts .= $post->ID . ","; ?> <div><?php the_title(); ?></div> <!-- Post Stuff --> <?php endwhile; endif; ?> </div> <?php $myPosts .= "0" ?> <?php add_filter('posts_where', 'post_strip'); ?> <div><br/> <?php //$my_query = new WP_Query('category_name=Life&showposts=15'); $my_query = new WP_Query('showposts=5'); while ($my_query->have_posts()) : $my_query->the_post();?> <div><?php the_title(); ?></div> <!-- Post Stuff --> <?php endwhile; ?> </div> <?php remove_filter('posts_where', 'post_strip'); ?> <?php /* End non-duplicates */ ?>
Initial URL
http://w3updates.com/wordpress-tips-and-tricks-avoid-duplicate-posts/
Initial Description
Initial Title
Wordpress Tips and Tricks : Avoid Duplicate Posts
Initial Tags
wordpress
Initial Language
PHP