• Resolved eastbank

    (@eastbank)


    Hi there, love the plugin!

    I’ve created a custom php template for my event detail pages and I’m wondering how I can use the conditional tags with it.

    For example, this is how I’m loading the booking form:
    <?php echo $EM_Event->output("#_BOOKINGFORM"); ?>

    How would I go about using the {has_bookings}{/has_bookings} conditional tags with that? I’d only like to display the booking form content if bookings are enabled for the event. Currently it shows the message ‘Online bookings are not available for this event’. I’d like to just not display that block at all.

    So I guess what I need is the equivalent to this:

    {has_bookings}
    <?php echo $EM_Event->output(“#_BOOKINGFORM”); ?>
    {/has_bookings}

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • $EM_Event->output() is the actual function that processes the placeholders, o putting any EM code outside of that will not get processed, as the EM function doesn’t see it.

    Have you tried a simple:

    $EM_Event->output( "{has_bookings}#_BOOKINGFORM{/has_bookings"" );
    

    Or do it in purely php:

    if( $EM_Event->event_rsvp === 1) {
      echo $EM_Event->output("#_BOOKINGFORM");
    }
    Plugin Support angelo_nwl

    (@angelo_nwl)

    you can find the php of conditional placeholder under events-manager/classes/em-event.php then search for function output()

    Thread Starter eastbank

    (@eastbank)

    Thank you guys so much! I used the purely php as I have the booking form wrapped in a container that I also wanted removed if there was no bookings. There was one small tweak needed, the number 1 needed to be in quotes.

    if( $EM_Event->event_rsvp === "1") {
      echo $EM_Event->output("#_BOOKINGFORM");
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Conditional tags in PHP?’ is closed to new replies.