0

I have a template that sets some stash values from a campign entry, such as campaigntag. This custom field is just a text input. What i'm then trying to do on the page is show a bunch of entries from another channel using the campaigntag as follows;

{exp:channel:entries
    channel="campaign"
    status="open"
    limit="1"
}
{exp:stash:set_value name="campaigntag" value="{campaign_tag}"}
{/exp:channel:entries}

{exp:tag:entries
    channel="event"
    status="open"
    orderby="title"
    sort="asc"
    paginate="bottom"
    limit="9"
    tag="{exp:stash:campaigntag}"
}
{title}
{/exp:tag:entries}

For some reason, I can't get any entries to display when I use a stash variable in the tag="". I can get results if I hard code the tag in here.

Wondered if someone might be able to help figure out what's going on.

Thanks.

0

I tend to promote my Stash tags up to first-class citizens in terms of parse order - Something like this will put the Stash tags on an even footing, saving you from having to figure out complicated black magic parse-order convolutions like parse="inward":

{exp:stash:set_list name="campaign-vars" parse_tags="yes"}    
    {exp:channel:entries
        channel="campaign"
        status="open"
        limit="1"
    }
       {stash:campaigntag}{campaign_tag}{/stash:campaigntag}
       ...
    {/exp:channel:entries}
{/exp:stash:set_list}

{exp:stash:get_list name="campaign-vars"}
    {exp:tag:entries
        channel="event"
        status="open"
        orderby="title"
        sort="asc"
        paginate="bottom"
        limit="9"
        tag="{campaigntag}"
    }
       {title}
    {/exp:tag:entries}
{/exp:stash:get_list}
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.