• Resolved davecowen

    (@davecowen)


    We only have two venues, and lots and lots of events at each venue, so it’s a bit of a drag typing in their name each time. Would it be possible to be able to keep a list of venues in the main plugin, then have a drop-down menu of venues for the events?

    https://ww.wp.xz.cn/plugins/theatre/

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

    (@slimndap)

    This is possible with a little bit of PHP code.
    The filter to use is wpt/event_editor/fields, which can be used to replace the default text input for the venue field with something else (eg. a dropdown with just two options).

    Jeroen, Could you help out a little bit with the filter. I know I need to at least do this, but not sure what to do from there.

    `function wpt_venue_dropdown($fields, $event_id){

    return $fields;

    }

    add_filter(‘wpt/event_editor/fields’,’wpt_venue_dropdown’,10,3);

    I found that the keys changed depending on the action taking place. Is there a better way for me to check this?

    `function wpt_venue_dropdown($fields, $event_id){

    if( $fields[0][‘id’] === ‘wp_theatre_prod’ ){
    $fields[3][‘edit’] = array(“callback” => ‘editVenues’ );
    $fields[3][‘save’] = array(“callback” => ‘saveVenues’ );
    } else {
    $fields[2][‘edit’] = array(“callback” => ‘editVenues’ );
    $fields[2][‘save’] = array(“callback” => ‘saveVenues’ );
    }

    return $fields;

    }

    add_filter(‘wpt/event_editor/fields’,’wpt_venue_dropdown’,10,3);’

    Plugin Author Jeroen Schmit

    (@slimndap)

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Pull-down for venues’ is closed to new replies.