I'm trying to make my press release pages a little more fool-proof so instead of leaving the formatting of the location and date to the user I want to create a location matrix field (they type the city name and choose a state from a drop down menu; states MUST be spelled out hence the dropdown field) and prepend the output of this to the wygwam field that contains the press release content. I'll also add the date from the entry_date field to this. The output will eventually look something like this:
location, state - month day, year - begin press release...
I can set the stash without any problems and even output it on its own but I'm not sure how I could go about prepending it to the Wygwam content. In the past I've done this with MX Jumper but it required the addition of some random content at the beginning of the press release that could be swapped out. I'm hoping I can do this with Stash without the need for any extra content in the press release content field. Any suggestions on how this might work?
Update with template code:
{exp:channel:entries channel="press_releases"}
{exp:stash:set name="pr-date-loc"}
{press_release-location}<strong>{pr-city}, {pr-state} — {entry_date format="%F %j, %Y"} — </strong>{/press_release-location}
{/exp:stash:set}
{/exp:channel:entries}
{exp:channel:entries channel="press_releases"}
<h1>{press_release-title}</h1>
{exp:stash:prepend name="pr-date-loc"}
{press_release-content}
{/exp:stash:prepend}
{/exp:channel:entries}
{exp:stash:prepend name="my_var"}...{/exp:stash:prepend}
to prepend the enclosed value to an existing Stash variable. Or do you mean something else? If so, please update your question with the template code you are using.{press_release-location}
is my matrix field and{press_release-content}
is my Wygwam field. I just want to ensure{press_release-location}
starts inside the opening paragraph tag of{press_release-content}
so it conforms to standard practices of press releases.entries
tag and adding thematrix
tag above thewygwam
field work?