0

Wondering how I can pull {category_url_title} back from a Matrix field {recipes-related} that uses PLAYA related entries for {left} and {right}. I have this but doesn't pull the Category URL Title back so that I can build up the url.

{exp:channel:entries channel="{recipes_channel}" category_group="1" url_title="{last_segment}" dynamic="no" limit="1"}
    {recipes-related}
        {left}
            <a href="{path="{channel_url}/{categories}{category_url_title}{/categories}/{url_title}"}">
        {/left}
        {right}
            <a href="{path="{channel_url}/{categories}{category_url_title}{/categories}/{url_title}"}">
        {/right}
    {/recipes-related}
{/exp:channel:entries}
2
  • How is this question Low Seg2Cat-related? – Low Feb 12 '18 at 15:35
  • Hi Low, I've removed seg2cat from the questions as it's more to do with not being able to pull back the {category_url_title} from a related entry. – MBM Feb 12 '18 at 23:17
0

{category_url_title} is only defined within the {categories}{/categories} tag pair variable (or within an {exp:channel:categories} tag pair).

In your left / right sample code you don't open the {categories} tag pair before trying to retrieve the {category_url_title}, and so it fails.

In your second bit of code you explicitly open a {categories} tag pair, which explains why you get the {category_url_title} returned.

Perhaps something like this is what you need:

{left}
    <a href="{path="{channel_url}/{categories}{category_url_title}{/categories}/{url_title}"}">
{/left}

HTH

1
  • Thanks for the help :) Yeah so as soon as I put this inside the {left} it doesn't work. Move it outside them and it works. Hmm! – MBM Feb 12 '18 at 11: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.