Filterbar: Time of day customization

Home Forums Calendar Products Filter Bar Filterbar: Time of day customization

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1119129
    Bruce
    Participant

    By default, time of the day filter is restricted to the following categories:
    All Day, Morning, Afternoon, Evening, Night.
    I would like to, instead, use a different categorization.
    1:00-2:00, 2:00-3:00, 3:00-4:00, etc.

    I see that the function is in Time_of_Day.php, but it’s probably not recommended to customize this?
    Do you have any tips and suggestions?

    Thank you very much.

    #1119472
    Brook
    Participant

    Howdy Nokuko,

    I would love to help you with this.

    Your definitely right, it’s not a great idea to customize that file. However you can basically copy/paste its contents into a separate file like your theme’s functions.php. Then rename the class to add your own custom version of that filter. Or you could just copy this:

    https://gist.github.com/elimn/bfcda80db4711aafbb36d708e25fb4b6

    That does what you’re looking for from the sound of it.

    Does that all make sense? Will that work for you? Please let me know.

    Cheers!

    – Brook

    #1120278
    Bruce
    Participant

    Thank you so much for your help!

    I copied your code into my theme function.php.
    Instead of your

    		$time_of_day_array = array(
    			'allday' => __( 'All Day', 'tribe-events-filter-view' ),
    			'13-14' => __( '1:00-2:00 pm', 'tribe-events-filter-view' ),
    			'14-15' => __( '2:00-3:00 pm', 'tribe-events-filter-view' ),
    			'15-16' => __( '3:00-4:00 pm', 'tribe-events-filter-view' ),
    			'16-17' => __( '3:00-5:00 pm', 'tribe-events-filter-view' ),
    			'17-18' => __( '3:00-6:00 pm', 'tribe-events-filter-view' ),
    			'18-19' => __( '3:00-7:00 pm', 'tribe-events-filter-view' ),
    			'19-20' => __( '3:00-8:00 pm', 'tribe-events-filter-view' ),
    			'20-21' => __( '8:00-9:00 pm', 'tribe-events-filter-view' ),
    			'21-22' => __( '9:00-10:00 pm', 'tribe-events-filter-view' ),
    			'22-23' => __( '10:00-11:00 pm', 'tribe-events-filter-view' ),
    			'23-24' => __( '11:00-12:00 pm', 'tribe-events-filter-view' ),
    		);
    

    I did

    
    		$time_of_day_array = array(
                            'allday' => __( 'All Day', 'tribe-events-filter-view' ),
    			'13-14' => __( '1:00-2:00 pm', 'tribe-events-filter-view' ),
    			'14-15' => __( '2:00-3:00 pm', 'tribe-events-filter-view' ),
    			'15-16' => __( '3:00-4:00 pm', 'tribe-events-filter-view' ),
    			'16-17' => __( '4:00-5:00 pm', 'tribe-events-filter-view' ),
    			'17-18' => __( '5:00-6:00 pm', 'tribe-events-filter-view' ),
    		);
    

    Because I made changes to your suggested code, are any other modifications needed within your code?

    I am asking because it is not finding some of the events. (so far, I cannot figure out why it works for some and why it doesn’t work for others)

    Thanks!

    #1120433
    Brook
    Participant

    Hello again,

    Those looks like some solid modifications, you even corrected my labeling errors! I do not see anything in your code that should be causing it to break, but in the interest of being forthright I  have not tested your code or mine extensively.

    Do you have some example of events you can’t find using those filters that should show up? Is it possible to get a link to your site, perhaps in a private reply? I can not guarantee a lot of help here because we can only do so much with modifications, but I would definitely like to look into this a bit more. 🙂

    • Brook
    #1120521
    Bruce
    Participant

    This reply is private.

    #1120547
    Bruce
    Participant

    This reply is private.

    #1121046
    Brook
    Participant

    This reply is private.

    #1121750
    Bruce
    Participant

    This reply is private.

    #1122864
    Brook
    Participant

    This reply is private.

    #1129329
    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 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Filterbar: Time of day customization’ is closed to new replies.