Home › Forums › Calendar Products › Filter Bar › Filterbar: Time of day customization
- This topic has 10 replies, 4 voices, and was last updated 9 years, 10 months ago by
Bruce.
-
AuthorPosts
-
May 26, 2016 at 8:16 am #1119129
Bruce
ParticipantBy 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.
May 26, 2016 at 3:52 pm #1119472Brook
ParticipantHowdy 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
May 29, 2016 at 5:54 pm #1120278Bruce
ParticipantThank 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!
May 30, 2016 at 11:33 am #1120433Brook
ParticipantHello 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
May 30, 2016 at 6:20 pm #1120521Bruce
ParticipantThis reply is private.
May 30, 2016 at 10:00 pm #1120547Bruce
ParticipantThis reply is private.
May 31, 2016 at 11:26 pm #1121046Brook
ParticipantThis reply is private.
June 2, 2016 at 10:54 am #1121750Bruce
ParticipantThis reply is private.
June 5, 2016 at 10:55 pm #1122864Brook
ParticipantThis reply is private.
June 20, 2016 at 9:35 am #1129329Support Droid
KeymasterThis 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. -
AuthorPosts
- The topic ‘Filterbar: Time of day customization’ is closed to new replies.
