Plugin Author
Franky
(@liedekef)
Placeholders are meant to stay as is in EME templates, they get replaced when the template is actually being used.
For the rest I don’t think I actually understand what you’re saying or trying to do here …
I got similar situation to this one:
https://wordpress.stackexchange.com/questions/34205/are-shortcode-functions-applied-while-rendering-the-content-or-are-they-execute
I found eme_events_format_prefilter filter and I suspect I should make sure my shortcode renders before this point.
So basically I got a visual editor(Elementor type), after building the layout it provides the shortcode.
So I’m building my layout and insert placeholders. Usually, when I use Custom Shortcode Content plugin, for example, it renders just as intended.
But here it displays placeholders as is.
So I thought, may be if I tell to render this tool shortcode first and then EME – then placeholders will be in the flow already – before the time to render them.
So, EME gives me perfect render of this Visual Editor tool, the issue is it makes it after placeholders are rendered and I need them to render after this shortcode does
Hope it’s a bit more clear now.
-
This reply was modified 4 years, 5 months ago by
signale.
function my_eme_extra_event_format_filter($format, $event) {
return do_shortcode("[thrive_leads id='101']");
}
add_filter('eme_events_format_prefilter','my_eme_extra_event_format_filter',10,3);
I’ve tried this and it even works, though not right(I should check on the correct template part I guess), but it shows that it’s possible
https://ivan-chay.seo-fin.com/events/orality-in-james-joyce-conference/#
It loads for a long time, but eventually renders correct(except for the map)
-
This reply was modified 4 years, 5 months ago by
signale.
-
This reply was modified 4 years, 5 months ago by
signale.
Plugin Author
Franky
(@liedekef)
I don’t know what thrive_leads does, nor the meaning of the id parameter, but eme_events_format_prefilter expects the modified $format to be returned. If your thrive_leads does that, then all is ok π
Hey, Franky, thank you for your reply. My apologies for not being clear.
But yes, you got the idea exactly as this is.
I managed to make it work eventually. Though my solution is not precisely elegant.
I just set a flag to each template to differ them and define which shortcode to render.
Could you please tell if that’s possible to check the template id/name through the $format variable? Something like $format[“template_name”]
I just feel like violating something implementing it through checking the string containing.
Thank you, when I will be able to evaluate this plugin, I will rate it with a detailed analyses. But I wish to make it consiously, knowing and seeing the entire system. Now I’m only learning it, seems very right system
Plugin Author
Franky
(@liedekef)
The filter eme_events_format_prefilter gets executed in eme_replace_event_placeholders , which in fact is called in several places. The $format which is given also as argument to that function is not always a result of an EME template: it can be a fixed string, a global EME setting etc …
I have to admit that that filter was created as one of the first filters, without having a good understanding of filters at that time π
What you can always try is entering the shortcode in the EME template that you intend to use for e.g. single event format. And just call eme_events_format_prefilter to do the shortcode-call:
function my_eme_extra_event_format_filter($format, $event) {
return do_shortcode($format);
}
add_filter('eme_events_format_prefilter','my_eme_extra_event_format_filter',10,2);
Edit: I correct 3 to 2 for number of arguments.
-
This reply was modified 4 years, 5 months ago by
Franky.
Yeah, cool, now no need for checking which template or else is processing, now it’s much better, brilliant, thank you, Franky!