How can I add custom field support without editing the plugin files themselves ?
-
Hi Jeroen
I am working on a website using the theatre plugin, and the plugin is great ! It handles nicely a production with multiple dates and a single date event of that production
I have added a teaser/slogan line custom field (using WordPress’s core custom field feature – not ACF ) to a production /event such that it is displayed just below the title of a) the individual production page , and b) the production entry in the productions/events listing page.
To do this I have added the custom field in php to the theme’s page template file – as a child theme, and also defined a custom set of fields in the [wpt_production] shortcode as described in the plugin’s documentation on Shortcodes , which also describes that you can use a custom field if you have defined one … So I defined , for past productions :
[wpt_productions start=”1990-01″ end=”now” order= “desc”]{{thumbnail|permalink}} {{title|permalink}} {{teaser}} {{dates}} {{cities}} [/wpt_productions]
… where {{teaser}} is the custom field
The problem is that the Theatre plugin, for the Production page , post type wp_theatre_prod, is not setup to support WP core custom fields.
But if I add support manually in the wpt_setup file :
Ie in function register_post_types() { …}
Change line :
‘supports’ => array(‘title’, ‘editor’, ‘excerpt’, ‘thumbnail’,’comments’),
To
‘supports’ => array(‘title’, ‘editor’, ‘excerpt’, ‘thumbnail’,’comments’, ‘custom-fields’),Then all works fine !
So my questions are
Q1 : Why does the plugin not support custom fields when it implies that it can , in the docs at https://github.com/slimndap/wp-theatre/wiki/Shortcodes > in section ‘Production listing’ > ‘Template’ > ‘Custom fields’
Q2 : Is there a way / add action / filter to add custom field support without having to directly edit a plugin file ( not good as any edits will get wiped on an update) ?
Q3 : How does using the plugin Advanced Custom Fields compare in these regards ?
(I do see with the WP Core CF, that for a user it could be a bit confusing when they see as choices all the other event fields . maybe ACF is better in here, but I havn’t tried )Thanks
- The topic ‘How can I add custom field support without editing the plugin files themselves ?’ is closed to new replies.