Adding Custom Filter to Filter Bar

Home Forums Calendar Products Filter Bar Adding Custom Filter to Filter Bar

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #109679
    wheretoplaygames
    Participant

    In the topic “Custom Filter options?” a suggestion was given for adding a filter that included:
    [quote]check out \the-events-calendar-filterbar\lib\filters\TribeEventsFilter_Cost.php. You might even copy that as your starting point.[/quote]

    and: [quote]How I would do it is by adding my TEC filter to the tribe_events_all_filters_array[/quote] <— In what file do i do add the filter to the array?

    Thanks! Any ETA on the documentation?

    #110084
    Barry
    Member

    Hi – great question. Documentation is something we’re slowly making headway on but there may be a little lag getting things up to speed – bear with us though, I’m sure we’ll get there 🙂

    How I would do it is by adding my TEC filter to the tribe_events_all_filters_array

    <— In what file do i do add the filter to the array?

    So you could do this from your theme’s functions.php file or even a custom plugin. The general form is:

    add_filter( 'tribe_events_all_filters_array', 'custom_add_filter_callback' );

    With a corresponding callback like:

    function custom_add_filter_callback( $filters ) {
    	$filters['unique_slug'] = array(
    		'name' => 'your_filter_name',
    		'type' => '''',
    		'admin_form' => '',
    	);
    
    	return $filters;
    }

    Really at this point the best approach is to study the code in the plugin itself and base your own solution on the practices you see there – hope that helps 🙂

    #116846
    wheretoplaygames
    Participant

    Thank you for your help with this, but i’m not in a position to learn both WordPress and plugin coding right now. Is there any chance that the ability to add custom filters through the admin will be available soon?

    #117301
    Barry
    Member

    Hi!

    Is there any chance that the ability to add custom filters through the admin will be available soon?

    We may add additional filters in the future (and much will be based on what we see over on UserVoice – so please don’t hesitate to post your thoughts there) however I’m not sure how practical it would be to create a user interface to let you define your own arbitrary filters, if that’s what you mean.

    Please do take the time to detail how you envision things within a feature request, though, we’re absolutely open to new ideas and the more detail the better.

    Thanks!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Adding Custom Filter to Filter Bar’ is closed to new replies.