• Resolved nast0

    (@nast0)


    I’ve created a custom category page (archive-211.php) which will be a category for videos. If someone visits this category (www.url.com/?cat=211) I don’t want them to see 6 posts on one page like they do in my other categories… i want them to only see 1 post, and the usual (next >) links. I can’t edit the settings, as that would change ALL my categories.

    I can’t find anywhere how to do this. I’ve read the codex, Googled, etc but no luck.

    Any pointers on how I get the loop to stop after 1 post in my category template?

    Thanks,
    n

Viewing 2 replies - 1 through 2 (of 2 total)
  • MichaelH

    (@michaelh)

    Interesting that the archive-211.php works–thought that would need to be category-211.php according to the Template Hierarchy article.

    Here’s an example of code you can use in your category template to show 3 posts per page, regardless of what’s in your Settings->Reading.

    <?php
    $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
    query_posts($query_string . ‘&paged=’.$paged .’&showposts=3′);
    ?>

    Thread Starter nast0

    (@nast0)

    That was a typo actually, as I have an archive.php I got confuddled, you’re correct that my file is called “category-211.php”.

    I’ve dropped the code right in, and it works like a charm, many thanks for the help.

    n

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom Number of Posts in a Category’ is closed to new replies.