• Resolved doodaf

    (@doodaf)


    Hi Jeroen

    I have the next four events showing on the home page using the code below. Can you tell me how I can adjust this to only display events in the category ‘concert’ please?

    <?php
    $args = array(
        'start' =>'now',
    	'limit' => 4,
    );
    $events = $wp_theatre->events->get($args);
    foreach ($events as $event) {
        echo '<div class="col-md-3 home-page-event">';
    	echo '<div class="inner">';
    	echo $event->production()->thumbnail_html('homepage-thumb');
    	echo '<h3>'.$event->permalink_html( ).'</h3>';
    	echo $event->venue();
    	echo $event->startdate_html();
    	echo '</div></div>';
    }
    ?>

    Many thanks!

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

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

    (@slimndap)

    This should do it:

    <?php
    $args = array(
      'start' =>'now',
      'limit' => 4,
      'category_name' => 'concert',
    );
    $events = $wp_theatre->events->get($args);
    foreach ($events as $event) {
        echo '<div class="col-md-3 home-page-event">';
    	echo '<div class="inner">';
    	echo $event->production()->thumbnail_html('homepage-thumb');
    	echo '<h3>'.$event->permalink_html( ).'</h3>';
    	echo $event->venue();
    	echo $event->startdate_html();
    	echo '</div></div>';
    }
    ?>
    Thread Starter doodaf

    (@doodaf)

    Brilliant, thanks! I tried something similar but didn’t include the crucial ‘_name’ after ‘category’.

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Define category of events to display’ is closed to new replies.