• Hi! I’ve found a great short code to show the last X most commented posts. But it seems it doesn’t work very well as it’s actually not showing the most commented posts…

    Here is my code:

    <?php $popular = new WP_Query('orderby=comment_count&posts_per_page=6'); ?>
    <?php while ($popular->have_posts()) : $popular->the_post(); ?>	
    
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Read: <?php the_title(); ?>"><?php the_title(); ?></a>
    
    <?php endwhile; ?>
    <?php wp_reset_query(); ?>

    See, it’s simple (contrary to the many codes I’ve seen before…) but it doesn’t work. Any help is welcome! Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Alkorr

    (@alkorr)

    No idea? I took a look at other codes to get the most commented posts but these codes are huge……… so many lines and database queries.

    I’m puzzled!

    Thread Starter Alkorr

    (@alkorr)

    I know what’s wrong!! It is because of a special loop I use in my header! But I’m afraid only alchymyth can help me on this issue… If you read this thread my friend, could you please help me?

    The problem is the 6 most commented posts are showning but above them appear my 3 sticky posts (from the loop in my header, remember this thread: http://wordpress.org/support/topic/do-not-duplicate-post-covering-2-queries).

    I don’t want to exclude all stickies from the list of the most commented posts (because a sticky post can be among the most comments posts of course) but I just want the stickies not to show above this list only because they are stickies…

    Geez, WordPress loops are killing me… But thanks for your help! 🙂

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Most Commented Posts’ is closed to new replies.