• Resolved mdjbrighton

    (@mdjbrighton)


    Excellent plugin

    I’m building a website for a site which has lots of shows which run only for a few days.

    I am trying to create a php template for productions, similar to [wpt_productions start=”now”] and wondered how I would start. I don’t want to show individual events.

    I have seen your code on gitbhub

    Also is there a way of producing a shortcode for the event-id – I need this to tap into my booking system.

    Many thanks

    https://wordpress.org/plugins/theatre/

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

    (@slimndap)

    Do you want to:

    • create a new page that show a (filtered) list of productions or
    • customize the page of a single production or
    • do something else?

    Can you post your second question in a separate thread? Be sure to tell me what the shortcode is supposed to do. And perhaps the name of your booking system.

    Jeroen

    Thread Starter mdjbrighton

    (@mdjbrighton)

    I want to create a page to show a filtered list of productions.

    Plugin Author Jeroen Schmit

    (@slimndap)

    Then you can just create a new page inside WordPress and place the [wpt_productions] shortcode inside the content. You can then use these examples to customize your list.

    Thread Starter mdjbrighton

    (@mdjbrighton)

    Thanks,

    I’ve used this already, and it works really well.

    I just wondered how I could add this directly to the template,

    I am using ACF which works well mostly, but using shortcodes doesn’t allow me to add some of the ACF fields as classes, for example <h2 class=”{{colours}}”>. While I can output {{colours}} as a text field.

    Many thanks

    Plugin Author Jeroen Schmit

    (@slimndap)

    Try this inside your template:

    $args = array(
    'template' => '<h2 class="{{colours}}">{{title}}</h2>',
    'start' => 'now',
    );
    echo $wp_theatre->productions->html($args);
    Thread Starter mdjbrighton

    (@mdjbrighton)

    Great, thank you.

    I will let you know how I get on.

    Thread Starter mdjbrighton

    (@mdjbrighton)

    I’m nearly there.

    The code results in the custom field being surrounded by

    <div class=”wp_theatre_prod_colours”>’

    So I need to strip out the html.

    I’ve found I can strip out the html by commenting out a couple of lines in wpt_productions.php around line 579

    if ($args['html']) {
    			$html = '';
    			//$html.= '<div class="'.self::post_type_name.'_'.$field.'">';
    			$html.= $this->apply_template_filters($this->{$field}, $args['filters']);
    			//$html.= '</div>';

    However, I don’t really want to edit the plugin files.

    Is there a better was of doing this?

    Otherwise the plugin is doing everything I want it to.

    Plugin Author Jeroen Schmit

    (@slimndap)

    You need to use the wpt_production_{$field}_html filter.

    Something like:

    function remove_wrappers_from_colours( $html, $production ) {
    return $production->custom('colours');
    }
    add_filter('wpt_production_colours_html', 'remove_wrappers_from_colours', 10, 2);
Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Creating a php tempate for productions’ is closed to new replies.