• Resolved doodaf

    (@doodaf)


    Hi Jeroen

    Another question from me – can you tell me how to call a single event in a single-wp_theatre_prod.php file? I’ve looked through the files on github but can’t see it there.

    What I mean is something similar to this, but for a single event:

    $args = array(
        'start' =>'now',
    );
    $events = $wp_theatre->events->get($args);
    foreach ($events as $event) {
        echo $event->title();
        // do other stuff with your event
    }

    Thanks!

    https://www.ads-software.com/plugins/theatre/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jeroen Schmit

    (@slimndap)

    To display the event title on single-wp_theatre_prod.php you can just use the_title().

    To do more stuff with the single event:

    // Get the event.
    $event = new WPT_Production();
    
    // Get the event dates.
    $dates = $event->events();
    Thread Starter doodaf

    (@doodaf)

    Thanks – so is it a similar pattern for venue, start time, etc?

    Plugin Author Jeroen Schmit

    (@slimndap)

    Try this:

    $production = new WPT_Production();
    
    $events = $production->events();
    foreach ($events as $event) {
        echo $event->title();
        echo $event->venue();
    }
    Plugin Author Jeroen Schmit

    (@slimndap)

    It is a little bit confusing because the code of the plugin is using different terms for events and dates.

    In the code:

    ‘production’ = ‘event’
    ‘event’ = ‘date’

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Single event post’ is closed to new replies.