WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Show posts by category at the home

[Resolved] Show posts by category at the home

  • Hello,

    My blog has got 3 big categories and I would like to show just 3 post of them at my home grouped by the categories. So the home would look like this:

    CATEGORY 1
    Last Post 1
    Last Post 2
    Last Post 3

    CATEGORY 2
    Last Post 1
    Last Post 2
    Last Post 3

    CATEGORY 3
    Last Post 1
    Last Post 2
    Last Post 3

    I have got other small categories but I just want to show the 3 biggest.

    I found that it can be done using Multiple Loops (http://codex.wordpress.org/The_Loop) but I couldn’t make it work.

    Does anybody know how to do it?
    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Try something like this…

    <?php query_posts('cat=1&posts_per_page=3');
       if (have_posts()) : while (have_posts()) : the_post();
         the_content();
         endwhile;
       endif; ?>
    
    <?php query_posts('cat=2&posts_per_page=3');
       if (have_posts()) : while (have_posts()) : the_post();
         the_content();
         endwhile;
       endif; ?>
    
    <?php query_posts('cat=3&posts_per_page=3');
         if (have_posts()) : while (have_posts()) : the_post();
           the_content();
         endwhile;
       endif; ?>

    That should get you very close.

    Thank you very much eisenbart!
    It works 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Show posts by category at the home’ is closed to new replies.