The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

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

  1. niki
    Posted 10 years ago #


    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
    Posted 10 years ago #

    After reading this article:
    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