Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    have you tried it on the 20 11 theme? shortcodes should work fine with descriptions.

    Thread Starter richplane

    (@richplane)

    @aglonwl – Thanks – but I’m not sure what you’re suggesting here. The client is entering event data and trying to insert images with captions as you would do on posts and pages. I don’t think do_shortcode() will help.

    @marcus – you say ‘should’ – do you know that they do work OK? None of the EM-powered sites I’ve seen have captioned images inline in the descriptions. The demo on demo.wp-events-plugin.com/ doesn’t.

    We’re using an events-single template, so it’s the #_EVENTNOTES placeholder replacement that seems to be going askew.

    I tried this one and seems to be working fine;

    on event details html, I have this

    [caption id="attachment_953" align="alignnone" width="300"]<a href="https://domain.com/assets/Mark-Lanegan-Band.jpeg"><img class="size-medium wp-image-953" title="Mark Lanegan Band" src="https://domain.com/assets/Mark-Lanegan-Band-300x221.jpg" alt="" width="300" height="221" /></a> Welcome[/caption]

    then on my Settings > Formats/Layouts > Event Formats > Default single event format I added this #_EVENTNOTES or for events-single template you can find sample snippet here – https://www.ads-software.com/support/topic/events-manager-eventslocation-pages-cant-get-sidebar?replies=20

    Thread Starter richplane

    (@richplane)

    OK, I disabled our theme template file and put a basic format in there hopefully sufficiently quickly that the client wouldn’t notice.

    (Interestingly, simply selecting ‘Yes’ for “Override with Formats?” in Events -> Settings -> Pages didn’t actually override the single-event template. I had to delete the file before the page updated. Anyway, beside the point.)

    The caption shortcode is indeed parsed correctly when I enter it directly into the Event Format textarea. So why doesn’t it work when I do <?= $event->output(‘#_EVENTNOTES’) ?> in our single-event.php template?

    – NB you’ll note I misled you before. We’re using a single-event.php template not an event-single.php one.

    We’re setting $event from em_get_event($post->ID, ‘post_id’); – can anyone see why the output method of the object this returns wouldn’t parse shortcodes? Perhaps $event->output() expects the shortcodes to have already been parsed? Can’t quite get my head around how this could work.

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    single-event.php is a WP template so it’ll override anything we try, override with formats would still work providing you’re outputting the_content()

    have you correctly instantiated $event? e.g.

    $EM_Event = em_get_event($post->ID, 'post_id');
    echo $EM_Event->output('#_EVENTNOTES');
    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    oops, skipped the last paragraph ??

    I’d try print_r($event) to make sure you have the right event then.

    Thread Starter richplane

    (@richplane)

    I’ve solved the problem.

    We obviously have the right event object – we’re seeing the correct data being pulled through when I do

    <?= $event->output(‘#_LOCATIONLINK’) ?>
    <?= $event->output(‘#_EVENTIMAGE{200,125}’) ?>

    etc. etc.

    The problem is because we’re using a WP template. WP will parse shortcodes in the_content() but we’re not using the_content().

    The solution is to create an event-single template (at /themes/<theme_name>/plugins/events-manager/templates/event-single.php), which just runs $event->output(‘#_EVENTNOTES’). Then replace that call in the single-event.php theme template with the_content().

    Just in case (!) that’s not clear to anyone: what’s happening is that WordPress is pulling up the theme’s single-event.php template for the event custom post type. When it see the the_content() call in this template, it gets hooked by Events Manager, which outputs its own template event-single.php into this spot.

    This is a great and powerful plugin; can’t really complain about these confusions and the minimal documentation given that it’s free.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: Events Manager] Caption shortcodes not being parsed’ is closed to new replies.