How to Initialize filters in custom extension

Home Forums Calendar Products Filter Bar How to Initialize filters in custom extension

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #917977
    Nancy Barraza
    Participant

    Hi, thanks for all the assistance with this https://theeventscalendar.com/support/forums/topic/overriding-classes-in-custom-extension/

    It gave me a general idea about how to create my own custom filters, but, i found an issue when i try to inlitialize the filter in a custom plugin..

    I added the filters inside the folder /events/lib/filters/TribeEventsFilter_EventType.php

    and initializing it as:

    $event_type = new TribeEventsFilter_EventType( __( ‘Event Type’, ‘tribe-events-filter-view’ ), ‘event-type’ );

    In my functions.php folder, but it is returning this error: Class ‘TribeEventsFilter_EventType’ not found in /Applications/XAMPP/xamppfiles/htdocs/MedSpeaks/wp-content/themes/medspeaks/functions.php on line 724
    can you please let me know what i’m doing wrong?

    Thank You.

    #919146
    Barry
    Member

    Hi Nancy,

    I’d be happy to offer up a pointer but this is really custom development territory so though we’d love to help in more detail I’m afraid this is the sort of thing you’re really going to need to drive forward by yourself.

    That said, it sounds as if your new class simply hasn’t been defined (perhaps the class file itself hasn’t been loaded).

    I added the filters inside the folder /events/lib/filters/TribeEventsFilter_EventType.php

    So if this is in a custom plugin are you certain it has been activated? If so, have you included or required the above file?

    I’m not too clear on why you instantiate it from your theme rather than the same plugin, but if you have to do this then perhaps as an added precaution you should “guard” things by testing to see if the class exists first of all (since if the plugin was inadvertently deactivated you’d end up with a crash inducing fatal-error, which isn’t ideal 😉 ).

    I hope that helps – and good luck 🙂

    #926817
    Barry
    Member

    Hi! It’s been a while so I’m going to go ahead and close this thread. If we can help with anything else, though, please don’t hesitate to create new threads as needed. Thanks!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘How to Initialize filters in custom extension’ is closed to new replies.