0

Are there any plugins that enhance next/prev entry linking for EE6? I need to be able to order them using a custom field instead of the default date.

I used to use the Advanced Prev Next Entry plugin which was perfect but it hasn't been updated in a very long time and there doesn't seem to be anything else out there.

Thanks.

2 Answers 2

0

You can simulate the next / prev behaviour using the paginate feature of the channel:entries tag. Have a look at the {previous_page} and {next_page} tags within the {paginate} variable. This approach will allow you to sort the results in any way that suits (within the limits of the channel entries ordering controls).

HTH

2
  • Thanks for the tip, but I can't seem to get this to work. I'm wondering if it's because of template routes. I'm trying to paginate a blog detail page template to allow going to the next post or previous post. I have the detail page setup using a template route so the URL is /blog/url-title-here. My route is /blog/{post:alpha_dash}. But I can't even get the pagination links to appear. Also, I would want the paginated URLs to follow the above URL structure and not add the standard pagination URL string. Is that even possible using pagination like this? Thanks.
    – mediapimp
    Jun 19, 2021 at 23:38
  • The channel entries tag will only paginate if it generates more than one entry - if you are pulling something like {exp:channel:entries channel=".." url_title="url-title-here"} then you only will have one entry returned. To get pagination you'll need to change the tag to pull three entries (prev, current, next). An alternative approach would be to save a list of the URL titles / entry_ids in the right order to a layout variable array and then manually create the prev- and next- links based on that info. Jun 20, 2021 at 13:59
0

If you are trying to paginate a blog detail page to allow going to the next post or previous post, you can try this way. Place this code at bottom of the blog detail template.

{exp:channel:next_entry channel="blog"}
    <div class="your_class">
        <a href="{path='blog/'}" alt="{title}">Previous</a>
    </div>
{/exp:channel:next_entry}
          
{exp:channel:prev_entry channel="blog"}              
    <div class="your_class">
        <a href="{path='blog/'}" alt="{title}">Next</a>
    </div>
{/exp:channel:prev_entry}
1
  • That orders them by date. I need to be able to order them by a custom field. The native EE next/prev has no parameter to change what determines the sort order like the orderby parameter does for channel entries.
    – mediapimp
    Jul 7, 2021 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.