WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] customised loop and categories with 2.0 (2 posts)

  1. niki
    Member
    Posted 8 years ago #

    Hi,

    I have just upgraded to WP2.0 *almost* seamlessly and am just trying to sort out a few glitches.

    I was previously using categories and then customised loops to give a blog page with "notes" down the lefthand side and "articles" in the main content area. (where notes and articles are different category names).

    The loops looked like this:

    <?php query_posts('category_name=article&showposts=7'); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    <!-- do stuff ... -->

    <?php endwhile; endif; ?>

    After the upgrade this format resulted in no posts being displayed.

    I have changed the first line to

    <?php query_posts('category=1&showposts=7'); ?>

    (ie I am using the category id number rather than the name). This now displays the last 7 posts from *all* categories.

    Do I need to change the way I am querying the posts?
    I would like to get back to displaying only the posts within a particular category.

  2. niki
    Member
    Posted 8 years ago #

    After reading this article:
    http://ifelse.co.uk/archives/2005/04/08/query_posts-redux/
    I changed the format to

    <?php query_posts('cat=1&showposts=7'); ?>

    and that seems to do the job.

Topic Closed

This topic has been closed to new replies.

About this Topic