show posts from only one catagory (2 posts)

  1. alyxia.oliviformis
    Posted 6 years ago #

    hey everyone :)

    im working on a website for a client that wants to have his posts displayed in each of the three columns of the website (ie drudgereport.com). i've created three categories (left, middle, right) and i thought it would be easy to tell my template to grab all the posts from each category and put them in their respective columns.... i've searched and researched and all i've come up with is this:

    <?php query_posts('category_name=Middle','showposts=1');

    the above is wasn't working... my php skills are very minimal, so any help would be greatly appreciated :)

    thanks in advance!

  2. knight42
    Posted 6 years ago #

    <?php $top_query = new WP_Query('showposts=YYY&cat=XXX'); ?>

    That should do it. XXX being either the category name or number, bit extra in there is showposts=YYY (replace YYY with number) which you can limit the amount of posts you want. Just delete that out if you want all of them.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.