• How do I list the top 5 most popular posts in category X? A link to a page explaining it is fine.

    Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You will need a plugin. Consider using WP-Stats in conjunction with WP Popular Posts.

    You can do it without a plugin if you want. Just some code based on the following to the template where you want the list appearing…

    <?php query_posts('category_name=work&showposts=5'); ?>
    <ul>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <li><?php the_title(); ?></li>
    <?php endwhile; ?>
    </ul>
    <?php endif; ?>

    that will show the first 5 posts from a category called ‘work’. Not exactly what you asked for in your question, but it’s definitely how to just ‘List Posts in Category X’ 🙂

    I did that 2 days ago. You can see it in http://www.europasobreruedas.com/cronicas, at the end the sidebar “IMPORTACIONES AUDI”, “IMPORTACIONES BMW”, etc. I added the code wrotten by monkey at the end the sidebar.php. By

    Almost exactly what I am looking for… however I am trying to create a navigation where it displays a list of categories with a sub-list of all posts within each category and loops this.

    Something like this:

    <li>
        <a href="category_url">CATEGORY</a>
    
    <ul>
    <li><a href="post_url">POST</a></li>
    </ul>
    </li>

    Of course I would want it to loop until it has listed all categories and all posts within these categories.

    Help is greatly appreciated.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How To List Posts in Category X?’ is closed to new replies.