Support » Plugin: Theater for WordPress » [wpt_production_events groupby=”day”] ?

  • Resolved darrcass


    Since we show a given film multiple times in one day, we would like to be able to group a production’s events by day [wpt_production_events groupby=”day”], which this shortcode does not currently support.

    Is there a filter I can use to achieve this?

    Is there a filter I can use to make this happen in the corresponding widget? (see link)

    • This topic was modified 4 months, 3 weeks ago by  darrcass.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • … or a way to do the same thing in PHP? I’ve been trying this approach as well, but can’t figure out how to access a production’s dates.

    Ok, got the code

    global $wp_theatre;
    $events = $wp_theatre->events;
    $args = array( 'groupby' => 'day' );
    $out = $events->get_html( $args );


    The date format for the headings, with the leading zeros for day, looks awful. Is there a way to filter that?

    Well this works just fine!

    function usfrida_wpt_production_events( $post_ID ) {
      $post_type = get_post_type( $post_ID );
      if( $post_type != 'wp_theatre_prod' ) return;
      global $wp_theatre;
      $events = $wp_theatre->events;
      $args = array(
        'production' => $post_ID,
        'start' => 'now',
        'groupby' => 'day',
        'template' => "{{datetime|date('g:i a')}} {{tickets}}"
      $out = '<h3 class="widget-title">SHOWTIMES</h3>';  
      $out .= $events->get_html( $args );
      echo $out;
    Plugin Author Jeroen Schmit


    Looks great!

    Another option is to the shortcode_atts_{$shortcode} filter that comes with WordPress. You can use it to add support for the groupby parameter to the [wpt_production_events] shortcode.

    See for the filter.

    Maybe something like (untested):

    function usfrida_add_groupby_support( $out, $pairs, $atts, $shortcode ) {
      $out[ 'groupby' ] = 'day';
      return $out;
    add_filter( 'shortcode_atts_wpt_production_events', 'usfrida_add_groupby_support', 10, 4 );

    Oooo! That looks cool. And possibly more “correct,” but I have tried to run “do_shortcode” in a template and it doesn’t seem to work.

    Right now I just stuck my above code into the sidebar and it looks pretty good.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.