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
I want to create a page to show a filtered list of productions.
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.
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
Try this inside your template:
$args = array(
'template' => '<h2 class="{{colours}}">{{title}}</h2>',
'start' => 'now',
);
echo $wp_theatre->productions->html($args);
Great, thank you.
I will let you know how I get on.
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.
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);