• Resolved signale

    (@signale)


    Hi! I’m trying to use EME’s placeholders in the shortcode’s code somewhere and then insert the shortcode into the EME’s template.
    It renders fine, but the placeholders display as is. Is there may be some way to render the shortcode first and then already to render placeholders?
    Thus I would be able to get an ability visually edit the template.
    Or may be you got some idea for designing the template? I thought some css elements generator or a pure html?
    It’s slightly hard for the maintenance so I’m trying to find something more handy.
    Thanks!

    • This topic was modified 4 years, 5 months ago by signale.
Viewing 7 replies - 1 through 7 (of 7 total)
  • 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 …

    Thread Starter signale

    (@signale)

    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.
    Thread Starter signale

    (@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 πŸ™‚

    Thread Starter signale

    (@signale)

    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.
    Thread Starter signale

    (@signale)

    Yeah, cool, now no need for checking which template or else is processing, now it’s much better, brilliant, thank you, Franky!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Shortcode and placeholder render order’ is closed to new replies.