Hi
I have some duplicate posts issues on my website, and I can delete them using a cron job, but they still appears a couple hours before the cron delete them.
I find an ugly solution for old wordpress versions describe here.
But it doesn't work anymore.
So I wondering if it's possible to simply hide posts which have same titles in a loop?
here his my actual code to display posts :
<?php
$cat_args = array(
'exclude_tree' => 1,
'depth' => 1,
'child_of' => 0,
);
$categories = get_categories($cat_args);
foreach($categories as $category) {
if ($category->category_parent == 0) {
echo '<li id="'.$category->cat_ID.'" class="'.$category->name.'"><div class="list-head"><h2><a>name.'" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" '.'><img src="'.get_bloginfo("template_url").'/img/icon16.gif" class="'.$category->name.'" /><span>' . $category->name.'</span></a></h2></div>';
echo '<a href="void(0)"></a><a href="void(0)"></a><div class="paneflow"><div class="pane">
<ul>';
$post_args = array(
'numberposts' => 20,
'category' => $category->term_id
);
$posts = get_posts($post_args);
foreach($posts as $post) {
?>
<li>
<!-- the posts -->
<?php echo get_the_post_thumbnail($post->ID, 'thumbnail'); ?>
<?php the_title() ?>
<?php the_excerpt(); ?>
<!-- the posts -->
</li>
<?php }echo '</ul>
</div></div>';
}
}
?>
What do you think?
Thanks