Add a custom filter

Home Forums Calendar Products Events Calendar PRO Add a custom filter

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1086583
    Thibault
    Participant

    Hello,

    I’m trying to add a custom filter (EventCountry) in my FilterBar.
    I found some threads but they are not helping. All of them are outdated (3.X) though.

    What I did so far:
    /src/Tribe/Filters/Venue.php has been duplicated in Country.php
    Class name has been changed accordingly. I change the meta_key occurences in SQLs to “_VenueCountry”.

    In functions.php :

    add_filter( 'tribe_events_all_filters_array', 'custom_add_filter_callback' );
    function custom_add_filter_callback( $filters ) {
        $filters['Country'] = array(
            'name' => 'Country',
            'type' => 'select',
        );
        return $filters;
    }

    This add a new filter in admin area. I don’t know what to specify in admin_form. This should call that function in Country.php but it actually doesn’t.

    new Tribe__Events__Filterbar__Filters__Country( sprintf( __( '%s Country', 'tribe-events-filter-view' ), tribe_get_event_label_singular() ), 'country' );
    Placed in my functions.php, this adds automatically an “Events Country” on the right side in admin filterbar area.
    Admin Form is loaded but Parameters like Title and so on aren’t saved.

    None of those two ways will display anything on the front end.

    Can you point me to a solution ?

    Thanks

    #1087469
    Brian
    Member

    Hi,

    Thanks for using our plugins. I can try to help out here, but I am limited in supporting customizations.

    Per our terms and conditions we support features of the plugins and although we try to help get you started on customizations for the most part you are going to have to take it on to complete.

    I do not have any resources on how to add a filter.

    However, they maybe a way to do this without coding.

    With 4.0 you can create an Additional Field in Pro for Country and then add that to the filter bar to sort.

    You can read about that here:

    Configuring Filter Bar

    Do you think you could get that to work?

    #1094109
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Add a custom filter’ is closed to new replies.