Filters

Filters

Filters are snippets of code that allow you to pass data through, they are used to enable overriding data used in plugins and themes. This plugin has several features allowing you to customise some aspects. Normally filters are applied to customise themes by inserting the code into a child theme’s functions.php.

Filters in Free

Widget Content

The widget uses the excerpt by default. This is normally Ok but can be filtered by other plugins. There is a filter in the template that allows this to be adjusted.

filter: (‘eawp_excerpt‘ , $excerpt)

So for instance you can use the post’s unfiltered excerpt like this

add_filter( ‘eawp_excerpt’, function($content) {
    global $post;
    return $post->post_excerpt;
}, 10,1);

Or even use the full content, or indeed override with anything.

add_filter( ‘eawp_excerpt’, function($content) {
    return the_content();
}, 10,1);

Event URL

This filter allows you to adjust the event URL. This is primarily so you can add tracking information to your link – see https://www.eventbrite.com/support/articles/en_US/How_To/how-to-create-promotional-tracking-links?lg=en_GB

Simplest usage would be

add_filter( 'wfea_event_url', function ( $url) {
	return $url . '?aff=affiliate1';
});

Optionally you can apply logic based on additional data, for example

add_filter( 'wfea_event_url', function ( $url, $event_id, $organizer, $venue, $category ) {
	$code = 'online';
	if ( property_exists( $venue, 'id' ) ) {
		switch ( $venue->id ) {
			case 12345:
				$code = 'venue1';
				break;
			case 999893:
				$code = 'venue2';
				break;
			default:
				$code = 'general';
		}
	}

	return $url . '?aff=' . $code;
}, 10, 5 );

Combined Date – Time Format

The combined date / time format appears in several layouts and typically looks like 12/02/2019, 10:00 – 11:00

filter: (‘wfea_combined_date_time_time_format‘ , $format)

$format defaults to your settings -> general -> time format

example: include am / pm

add_filter( 'wfea_combined_date_time_time_format', function ( $format ) {
	return 'g:i a';
}, 10, 1 );

filter: (‘wfea_combined_date_time_date_format‘ , $format)

$format defaults to your settings -> general -> date format, plus a , and space

example: display like 16th January

add_filter( 'wfea_combined_date_time_date_format', function ( $format ) {
	return 'jS F';
}, 10, 1 );

Date formats are documented here https://wordpress.org/support/article/formatting-date-and-time/

filter: (‘wfea_event_time‘ , $event_time, $start, $end)

Override totally

add_filter( 'wfea_event_time', function ( $event_time, $start, $end ) {
       // do you stuff  to update $event_time
	return $event_time;
}, 10, 1 );

filter: (‘wfea_eventbrite_event_start‘ , $start)

Do something with the local start time

add_filter( 'wfea_eventbrite_event_start', function ( $start ) {
       // do you stuff  to update $start
	return $start;
}, 10, 1 );

filter: (‘wfea_eventbrite_event_end‘ , $end)

Do something with the local end time

add_filter( 'wfea_eventbrite_event_end', function ( $end ) {
       // do you stuff  to update $end
	return $end;
}, 10, 1 );

Extra Filters in Pro

filter: (‘wfea_price_display‘ , $price_display, $min, $max, $currency)

Do something with the price display

add_filter( 'wfea_price_display', function ( $price_display, $min, $max, $currency) {
       // do you stuff  to update $end
	return $price_display;
}, 10, 4 );

filter: (‘wfea_currency_symbol‘ , $symbol, $currency)

Change the symbol for a currency. Evenbrite currencies are ISO e.g. USD

add_filter( 'wfea_currency_symbol', function ( $symbol, $currency) {
       // do you stuff  to update the symbol 
	return $symbol;
}, 10, 2 );

filter: (‘wfea_availability_display‘ , $msg, $total_sold, $event_capacity)

Do something with the ticket availability display

add_filter( 'wfea_availability_display', function ( $msg, $total_sold, $event_capacity) {
       // do you stuff  change $msg 
	return $msg;
}, 10, 3 );

Was this helpful?

Previous Article

Widget CSS