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

    (@slimndap)

    Yes, this is possible, but need to add some code to the functions.php of your theme. Here is an article that should get you started:
    http://theater.slimndap.com/link-the-event-location-to-the-venue-website/

    Thread Starter timtiernan84

    (@timtiernan84)

    Hi, I’ve followed this but it doesn’t appear to be working. It created the new Venue URL field but won’t apply it to the venue field when it exists. Are you able to help at all? The website is http://essex-tv.co.uk/pavilion/whats-on/

    Thanks for your help!

    Thread Starter timtiernan84

    (@timtiernan84)

    It’s supposed to be where the ‘more info’ statement is, just above the footer… thanks!

    Plugin Author Jeroen Schmit

    (@slimndap)

    I updated the code to do exactly what you’re trying to achieve:

    /**
     * Adds a new 'More info' field to the event editor.
     *
     * @param 	array 	$fields	The current fields of the event editor.
     * @return 	array			The new fields of the event editor.
     */
    function wpt_event_editor_add_more_info_field($fields) {
    	$new_fields = array();
    	foreach($fields as $field) {
    		$new_fields[] = $field;
    		if ('tickets_url' == $field['id']) {
    			$new_fields[] = array(
    				'id' => 'more_info',
    				'title' => 'More info',
    				'edit' => array(
    					'placeholder' => 'http://',
    				),
    			);
    		}
    	}
    	return $new_fields;
    }
    add_filter( 'wpt/event_editor/fields', 'wpt_event_editor_add_more_info_field');
    
    /**
     * Wraps the More Info value in a HTML link.
     *
     * @param 	string		$html	The current More Info value.
     * @param 	WPT_Event 	$event	The event.
     * @return 	string				The More Info value inside a HTML link.
     */
    function wpt_event_add_link_to_more_info($more_info, $event) {
    	if (!empty($more_info)) {
    		$more_info = '<a href="'.esc_attr($more_info).'" target="_blank">More info</a>';
    	}
    	return $more_info;
    }
    add_filter( 'wpt_event_more_info', 'wpt_event_add_link_to_more_info', 10, 2);

    Now you just need to add the new ‘More Info’ field to the template that is being used on the event page.

    1. Go to Theater -> Settings
    2. Scroll down to ‘Events on production pages’
    3. Paste the following in the ‘template’ field: {{thumbnail|permalink}}{{title|permalink}}{{excerpt}}{{tickets}}{{more_info}}.
    4. Save changes

    You can now enter a URL in the More Info field when you edit an event and the link will automatically appear on the event detail page.

    Thread Starter timtiernan84

    (@timtiernan84)

    Thanks so much, that worked! Is there a way of filtering on the front end by the existence of this? I’ve added another new field called ‘autism_friendly’ using the above as a guide, however I’d like to be able to show a list of just those events (there will be autism friendly screenings within a production)

    For example: http://essex-tv.co.uk/pavilion/autism-friendly-screenings/

    The only event showing should be the ‘Autism friendly screening’.

    Thanks for your help.

    Thread Starter timtiernan84

    (@timtiernan84)

    For example, is something like this possible?

    [wpt_events paginateby=”month” groupby=”day” autism_friendly=”Yes”]{{thumbnail}}<h3>{{title}}{{autism_friendly}}{{bbfc}}</h3><p>{{excerpt}}{{datetime}}{{tickets_url}}{{more_info}}</p>[/wpt_events]

    Plugin Author Jeroen Schmit

    (@slimndap)

    No, this is not possible (without coding).

    However, you could use categories instead:

    [wpt_events paginateby="month" groupby="day" category_name="autism_friendly"]{{thumbnail}}<h3>{{title}}{{bbfc}}</h3><p>{{excerpt}}{{datetime}}{{tickets_url}}{{more_info}}</p>[/wpt_events]
    Thread Starter timtiernan84

    (@timtiernan84)

    Thanks! but I can’t see how I can apply that to just one event within a production,

    Thread Starter timtiernan84

    (@timtiernan84)

    Also, how can I find the ID for a production?

    For example, to show all screenings of a particular production…:

    [wpt_production_events id=”16300″ paginateby=”month” groupby=”day”]{{thumbnail}}<h3>{{title}}{{autism_friendly}}{{bbfc}}</h3><p>{{excerpt}}{{datetime}}{{tickets_url}}{{more_info}}</p>[/wpt_production_events]

    The one I’ve used above is from the URL string (i.e. http://essex-tv.co.uk/pavilion/wp-admin/post.php?post=16300&action=edit)

    However, this doesn’t seem to work as the filter… am I looking in the wrong place?

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

The topic ‘Add extra field?’ is closed to new replies.