Forum
Remove cr/lf from eventDescRaw
Hi.
I'd like to improve how well my event pages work with Facebook by introducing some "proper" Open Graph tags:
<meta property="og:site_name" content="Grappenhall & Thelwall Royal British Legion" />
<meta property="og:title" content="<perch:events id="eventTitle" />" />
<meta property="og:description" content="<perch:events id="eventDescRaw" />" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://www.gtrbl.org.uk/events-event.php?event=<perch:events id="eventSlug" />" />
Is there any way to remove cr/lf from eventDescRaw?
Thanks in advance.
Hmm good question! I can't think of a way to do that with a template tag at the moment.
The fall back would be to add a new custom field for a short description. However, the people running the pages generally only add a short description anyway, so it would be preferable to adapt the existing field.
Ideally we'd have some sort of pluggable filters for this so you can use PHP functions.
The fallback would be to use
skip-template
to get a PHP array and then usestr_replace()
or similar.Do you happen to have an example of that knocking about? I do use an array to get the event data:
I'm reading the documentation but struggling to see how it all hangs together.
We don't have an example other than the documentation. Where are you stuck?
To be honest my Perch is a bit rusty; I've not done anything with it for some time.
I need to understand how the arrays work in templates so I'll read that bit and then post some details. Just writing a specification for a new project naturally powered with Perch so it will be tomorrow when I try it again.
You'd need to use
perch_events_custom()
, so something like:OK.
I'll have a play and post back if/when I get stuck.
Thanks for the replies folks. :-)