Category Archive (3 posts)

  1. Mike Everleth
    Posted 10 years ago #

    I'm trying to set up a 'category.php' that just lists the post titles with links (like an archive page). I've tried 2 different ways to do this and each have separate problems:

    1) If I use this sort of code:

    $cat = get_the_category();
    $cat = $cat[0];
    $posts = get_posts("category=" . $cat->cat_ID . "&numberposts=500");
    if( $posts ) :

    And then if I display my archive list, it will only return lists of the Parent categories. I.e. if I go to a Child category list, instead of just listing the posts in that Child category it returns the entire Parent category list. I don't want that, I just want the Child list.

    2) If I use a basic category code:

    <?php if ($posts) { ?>

      <?php foreach ($posts as $post) : start_wp(); ?>

    • "><?php the_title(); ?>
    • Then both Parent and Child-only lists are generated, but my category page is limited to just the last 10 entires. I need the category page to display ALL posts in the category.

      I've tried editing both pieces of code, but I don't know enough to get my category page to do what I want. Any suggestions?

  2. moshu
    Posted 10 years ago #

    a) Category listings usually show the posts in that category and all its children...
    b) to have different number of posts displayed in different views - you should us e aplugin:
    (the reason you see 10 posts only is that probably you have set in the Options > Reading 10 posts; and it applies to ALL views in WP)
    c) I never checked by you could try to see how it would work with children cats if you have separate category templates; e.g.
    category-YY.php for the parent and
    category-XX.php for the child cat (YY, XX = cat ID#).

  3. Mike Everleth
    Posted 10 years ago #

    Thanks. That plugin worked. The only pain-in-the-neck thing is that now whenever I want to add a new child and/or parent category, I have to remember to go add it to the CQS plugin screen. Still, not the worst thing in the world, I guess.

    And anyone who's curious, you can see what I created with the plugin here:

    Movie Review Archive

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.