0

My single entry page URL structure is as follows:

sitename.com/channel_name/category_url_title/entry_url_title

I want to have previous and next links on each single entry that are NOT limited to the category that is currently in the URL...I just need it to work by date alone, but I do need to retain this url structure...so basically when someone opens this link:

sitename.com/channel_name/category_1_url_title/entry_123_url_title

and clicks the next button it should take him to:

sitename.com/channel_name/category_22_url_title/entry_124_url_title

only sorting by entry date and ignoring the category as a filter

is this possible with some good queries or do I need an addon for it?

1

The Next/Prev entry links will not glean any category information in the URL, so you don't have to worry there.

This should work pretty easily with the Query module:

{exp:channel:next_entry channel="channel_name"}
    {exp:query sql="SELECT c.cat_url_title FROM exp_category_posts cp LEFT JOIN exp_categories c ON c.cat_id = cp.cat_id WHERE cp.entry_id = {entry_id} LIMIT 1"}
        <p>Next entry: <a href="/channel_name/{cat_url_title}/{url_title}">{title}</a></p>
    {/exp:query}
{/exp:channel:next_entry}

(Use the same code for the prev_entry tag.)

0

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.