[resolved] Link to the next item in the same category? (5 posts)

  1. spakainas
    Posted 2 years ago #

    Is there any way to display a link (on the individual pages catablog-items.php) to the next and to the previous item in the same category?

    It should look something like this:

    << Previous item 2/14 Next item >>

    And the problem is that <?php next_post_link(); ?> works but the "Next" "Previous" links go through all categories.
    I want that the "Next" link would not appear when the catalog end is reached.

    Cats page 2
    << Cats page 1 Cats page 3 >>

    Dogs page 2
    << Dogs page 1 Cats page 1 >>

    P.S. - I have exactly the same problem as this guy had in this topic but in the end there was no helpful answer.


  2. spakainas
    Posted 2 years ago #

    Just want to let it know that after few days of searches I finally solved it.
    If someone someday meets with the similar problem - here is how to solve it.

    1. I installed the plugin "Previous and Next Post in Same Taxonomy".
    2. Next - I changed code

    <?php previous_post_link('%link', '%title', false); ?>
    <?php next_post_link('%link', '%title>', false); ?>


    <?php be_previous_post_link('%link', '%title', true, '', 'catablog-terms'); ?>
    <?php be_next_post_link('%link', '%title', true, '', 'catablog-terms'); ?>

    If you changed the Default Catablog Options - instead of 'catablog-terms' use the "Category Pages Slugs" you have written under Catablog -> Public -> Category Pages Slug.
    Cheers! :)

  3. mbrsolution
    Posted 2 years ago #

    Hello spakainas, that is great news and it looks great your sample above.

    I am just a bit curious with your code above. I understand your code except the be_, where did get that code from? I am thinking of adding the above information to my blog for others to view but I need to know more about the be_ code.

    Kind regards

  4. spakainas
    Posted 2 years ago #

    Thank you.

    I just followed the plugin guidelines the author provided

    I read through plugin author channel that in future WordPress release 3.8 this plugin expansion I used will be available without plugin.

    All the best. :)

    P.S. - Might as well add your blog to favorites since I might find some info I need it in the future. :)

  5. mbrsolution
    Posted 2 years ago #

    Hello spakainas, thank you for the update. I did read the link your provided. It looks like it is a feature they will be adding in future WordPress versions :)

    You are quite welcome to follow my blog. I have a few CataBlog tutorials already :) Please peruse them and let me know if I can improve them or even add more ;)

    Kind regards

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic