I want to list out related entries when viewing an entry, regardless of channel but according to the category of the entry.

On the page where the entry is output, I output the entry in a traditional {exp:channel:entries} tag and close it.

Then, I start a new tag where I thought I'd have to get the category_id first, before inserting that id into the channel:entries tag. I use Stash for that.

And my tags looks like this:

{exp:channel:entries channel="channel1|channel2" limit='1' parse="inward"}
     {exp:stash:set name="cat" parse_tags="yes"}
        {exp:gwcode_categories entry_id="{entry_id}" last_only="yes" style="linear"}{cat_id}{/exp:gwcode_categories}


And right before I want to output related entries, I can get the stash variable fine like this:

<h1>{exp:stash:get name="cat" process="end"}</h1>

But then, when I try to use this variable directly in the next tag, it comes out blank. Most likely because of parse order. I know the code works because if I manually add an ID for category, the entries as listed out like you'd expect.

{exp:channel:entries channel="channel1|channel2" 
category='{exp:stash:get name="cat" process="end"}' limit="3" dynamic="no"}

What am I doing wrong? How can I get the correct parse order? Edit: Yes, I can use an embedded template, which is what I'll be doing if I can't get this to work.

1 Answer 1


What about just using the related_categories_mode="" parameter on the channel:entries tag?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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