• I am having an issue with my category pages. First off, the category page is named category-6.php, in case that matters. Here’s how I am calling my posts:

    <?php query_posts('cat=6,5,4'.get_option('posts_per_page')); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    However, pagination isn’t showing up at all. I’ve tried to implement some changes as shown here:

    https://www.ads-software.com/support/topic/57912#post-312858

    and the pagination link shows up for previous posts, but when I click the link it takes me to https://www.mysite.com/featured-articles/page/2/, which shows exactly the same post summaries as are on the previous page. Here is my code:

    <div class="navigation">
    	<div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div>
    	<div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div>
    </div>
    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
    <?php query_posts('cat=6,5,4&paged=$paged'); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    I need to get pagination working properly on these category pages. Does anyone have any solutions I’ve missed?

Viewing 5 replies - 16 through 20 (of 20 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Wait a minute. You’re doing this in a PAGE template? Oh. Well, there is your problem. You said originally that it was “category-6.php” which would have worked. That’s a category template. You don’t make a bloody PAGE for it, it gets a page automatically at /category/whatever/…

    You should never try to display Posts on a Page. There’s no reason for it, and when you try doing weird things like that, then yes, our answers won’t be right because we don’t ever take into account crazy people doing crazy things.

    No guarantees that this will work, because the idea of putting Posts on Pages is a dumb one to begin with, but…

    <?php
    $page = (get_query_var('page')) ? get_query_var('page') : 1;
    query_posts("cat=6,5,4&page=$page");
    ?>

    There is archive.php and there is archives.php – the first one displays multiple posts (in monthly and cat archives), the second one is displaying a list, usually generated by the get_archives tag and not a loop! So, no they work completely differently!

    It is nonsense to use a Page for category templates when you have a perfectly working system for that. WP recognizes if there is a Page templates and wants to do what is supposed to do with Pages.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Why? An archive file is listing multiple posts, is it not?

    Yes, but it’s not a Page. It’s just a page. Note the capital letters?

    A Page, as in “Write->Page” is wholly different than anything else. It’s a static entity, separate from all the rest of the hierarchical post structure. It’s not meant to display Posts, and it does it extraordinarily badly, as you have discovered.

    Everything else in WordPress is not a Page, and can display Posts just fine.

    Thread Starter macwise

    (@macwise)

    Ok, thank you, Otto and Moshu. I’m sorry for confusing that and taking us on this long roundabout journey, and thank you for taking the time to fill me in on how this should be done.

    Now, I’ve removed the Page, and have gotten the page category-6.php to show up at (url)/featured-articles/. However, (and please don’t hate me), I still seem to have issues with this category page. First of all, the query only displays the article that is in category 6, though the query requests category 4,5, and 6.

    Also, pagination still takes me to (url)/featured-articles/page/2, which brings back a 404 error.

    My code has not changed from my above posts.

    Thank you.

    @macwise

    use this when doing the query:

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
          query_posts("category_name=XXX&paged=$paged"); ?>

    this worked for me so i hope it does for you as well. the other guys here either didn’t know what they were talking about or didn’t understand you correctly

Viewing 5 replies - 16 through 20 (of 20 total)
  • The topic ‘Category Pagination bizarreness?’ is closed to new replies.