WordPress.org

Forums

[resolved] page navigation within category leaves current category (10 posts)

  1. skaufmann
    Member
    Posted 6 years ago #

    When I'm viewing posts filtered to a category and select next page, it leaves the category and goes to the non-filtered next page. It also does this for tags.

    Example:
    http://www.karieandscott.com/blog/category/gallery
    When viewing the above link and select the next page it jumps to
    http://www.karieandscott.com/blog/page/2
    rather than
    http://www.karieandscott.com/blog/category/gallery/page/2

  2. skaufmann
    Member
    Posted 6 years ago #

    anyone? I'm completely stumped on this one.

  3. skaufmann
    Member
    Posted 6 years ago #

    bump... please anyone?

  4. skaufmann
    Member
    Posted 6 years ago #

    Alright, I've found the culprit. CForms.

    After submitting a trac and help from a developer it was determined to be CForms.

    I am resolving this and opening a new post under CForms.

  5. greggo
    Member
    Posted 6 years ago #

    What do you mean the problem was CForms? I'm having the same issue and curious what kind of solutions there are.

  6. skaufmann
    Member
    Posted 6 years ago #

    I had no specifics other than when I disabled the plugin, the inter-category page navigation worked properly. I notified the developer of cforms and he quickly gave me a beta which worked. The beta is now part of the stable release from a number of releases ago so if you have the latest cforms it shouldn't be a problem.

    If you don't have cforms it might be another plugin stepping on the code. Disable all your plugins and check it. If it works enable one at a time (or small group) and test till it breaks. You'll find which one is breaking it.

  7. mattyk
    Member
    Posted 6 years ago #

    I'm having the exact same problem and I don't have any plugins installed

    I have the posts displayed on a "news" page which is actually the category.php page but when I click to see older posts it takes me back to the index.php page.

    I'm using this for my navigation:

    <div class="alignleft">
        <?php posts_nav_link('','','&laquo; Previous Entries') ?>
       </div>
       <div class="alignright">
        <?php posts_nav_link('','Next Entries &raquo;','') ?>
       </div>

    Are you using something different?

    Many thanks,
    Stumped.

  8. heriz
    Member
    Posted 6 years ago #

    Read Template_Tags/next_post_link

    If I understand you correctly, your code should read

    <div class="alignleft">
    <?php prev_post_link('%link', '&laquo; Previous Entries', TRUE); ?>
    </div>
    <div class="alignright">
    <?php next_post_link('%link', 'Next Entries &raquo;', TRUE); ?>
    </div>
  9. mattyk
    Member
    Posted 6 years ago #

    Thanks for the reply Heriz - I'm quite new to wordpress but isn't that to display the next single post rather than the next "page" of posts? - I'm probably wrong on this though.

    I tried adding the code to the page both inside and outside the loop but this broke the page.

    Just to be clear - I have a category page, that's displaying all the posts in the news category. The posts are limited to 3 so they should be paged. When I click "previous" it seems to go to the index page rather than staying on the category page. Also it says "Sorry, no posts matched your criteria"

    I did see something that sounded similar at the bottom of here: http://codex.wordpress.org/Using_Permalinks (Paged Navigation Doesn't Work ) but I went though the fix with no joy.

    Maybe I've set my whole loop up wrong. I have:

    <?php if (have_posts()) : ?>
     <ul id="news_list">
       <?php while (have_posts()) : the_post(); ?>
         <li><h2 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
    <?php the_title(); ?></a> <span class="date"><?php the_time('F jS, Y') ?></span> </h2>
    	<p><?php $excerpt = strip_tags(get_the_excerpt());
            echo $excerpt; ?></p> </li>
    
    <?php endwhile; ?>
    
    </ul>
     <div class="navigation">
       <div class="alignleft">
        <?php posts_nav_link('','','&laquo; Previous Entries') ?>
       </div>
       <div class="alignright">
        <?php posts_nav_link('','Next Entries &raquo;','') ?>
       </div>
     </div>
    
    <?php else : ?>
      <h2 class="center">Not Found</h2>
    <p class="center"><?php _e("Sorry, but you are looking for something that isn't here."); ?></p>
     <?php endif; ?>

    Maybe if someone would be kind enough to post their code I might be able to see where I am going wrong or if this is a HTACCESS problem.

    Many thanks
    Matt

  10. mattyk
    Member
    Posted 6 years ago #

    Got it! I was linking to my category.php page using this actual URL in my navigation:

    /news/

    Really though I needed to go:

    /category/news/

    phew!

Topic Closed

This topic has been closed to new replies.

About this Topic