OK
This is a little hard to explain.
What I am about to show by no means works but hopefully gives you an idea of what I am trying to achieve.
I am using gwcode to handle my categories I can find the category id number using the gwcode below which needs to be wrapped in a channel entries tag so it can find the entry’s url_title.
So this code gets my category number which for example is “7” - So I can print the cat_id I am after.
{exp:channel:entries}{exp:gwcode_categories entry_id='{entry_id}' style='linear' last_only='yes'}{cat_id}{/exp:gwcode_categories}{/exp:channel:entries}Then I want to use that cat number to determine the category the next/prev buttons use.
{exp:channel:prev_entry category="CAT ID HERE"}<a href="http://{site_url}{segment_1}/{url_title}" title="Previous Vehicle" class="prevButton"><span>Previous Vehicle</span></a>{/exp:channel:prev_entry}
{exp:channel:next_entry category="CAT ID HERE"}<a href="http://{site_url}{segment_1}/{url_title}" title="Next Vehicle" class="nextButton"><span>Next Vehicle</span></a>{/exp:channel:next_entry}Obviously I want this to be dynamic and can’t hard code the category number.
So I was thinking of doing something like this - which obviously didn’t work.
{preload_replace:current_category="{exp:channel:entries}{exp:gwcode_categories entry_id='{entry_id}' style='linear' last_only='yes'}{cat_id}{/exp:gwcode_categories}{/exp:channel:entries}"}
{exp:channel:prev_entry category="{current_category}"}<a href="http://{site_url}{segment_1}/{url_title}" title="Previous Vehicle" class="prevButton"><span>Previous Vehicle</span></a>{/exp:channel:prev_entry}
{exp:channel:next_entry category="{current_category}"}<a href="http://{site_url}{segment_1}/{url_title}" title="Next Vehicle" class="nextButton"><span>Next Vehicle</span></a>{/exp:channel:next_entry}I’m hoping that gets the point across, happy to explain more if need be.
My URL structure is: http://domain_name.com.au/channel/url_title