Support » Plugin: Theater for WordPress » 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

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

    (@slimndap)

    Hi!

    Q1: The plugin does support custom fields. It doesn’t support the custom fields meta box. I think your comment in Q3 explains nicely why.

    Q2: There is! You can use the wpt/setup/post_type/args/?post_type=wp_theatre_prod filter. See this line for the full definition.

    Q3: ACF is by far the best solution to add custom fields to production. You can add a ‘teaser’ field with ACF which should then be available in the shortcode as {{teaser}}.

    • This reply was modified 6 months, 3 weeks ago by Jeroen Schmit.
    Thread Starter aldebaran57

    (@aldebaran57)

    Hi Jeroen

    Thanks for the tip about the Advanced Custom Field plugin. I had never used ACF before. But I have now installed it and everything now works perfectly !

    So now in the page editor you just see the textfield for the custom field and that’s it – much simpler visually than WP core custom fields, which looks a mess – one reason being that with WP core CFs the definition of fields is in the same place as entering field values, whereas with ACF the definition of fields is in the Backend and only entry is in the editor.

    And with ACF, I don’t have to mess with Theatre plugin files / add a filter etc – it just works out of the box with ACF

    Thanks for your help

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How can I add custom field support without editing the plugin files themselves ?’ is closed to new replies.