Filter tribe-bar-date: default to current month
I love your plugin!
But…I’ve repeatedly encountered a usability issue with the filter tribe-bar-date (where the user must select a date from the “Events From” label/dropdown before selecting a calendar view from the “View As” dropdown. When users want to change the calendar view, they are not aware they first need to select a date before selecting a view. When they select a calendar view without selecting a date, the plugin returns results with no events.
Is there a way to have the “Events From” dropdown default to the current month, so that users do not have to select a date before selecting a view?
I searched the forum to see if anyone had similar issues but did not find anything.
Hi: I’m sorry you’re experiencing difficulties.
It looks to me like a conflict (possibly with something called a “polyfill script” which may be misfiring). I see you already tried deactivating all other plugins and switching to a default, unmodified theme – thanks for giving that a try: can you confirm what the outcome of this test was? Did you still experience this issue under those conditions?
Thanks for your reply. No, the issue still remains. This is my site:
What I’d like to achieve is what my friend did on his site:
Notice how on his site, the user isn’t required to select a date before changing calendar views. I asked my friend how he did this, and he said he modified a file somewhere, but couldn’t remember which one and what he changed. (He learned how to make the change from a Tribe forum post on of someone trying to do the same thing, but couldn’t remember how he found that post). I searched for the post myself, and couldn’t find it.
Any assistance would be much appreciated!Correct Answer
I’m surprised you say those troubleshooting steps don’t help, I’m pretty sure I can see the code in question that is causing this issue in a script and it appears to be added by your theme:
themes/bootstrap/library/js/scripts.js (lines 62-85)
Are you positive switching to a default theme did not help? If alternatively you want to remove the placeholder value to avoid this issue (as your theme is taking the placeholder and converting to an actual value, which is causing this) then you could do something like this:
- Check out the Themer’s Guide for an overview of template overrides and how they work
- Override modules/bar.php
- Below the line reading $views = tribe_events_get_views() try adding the following:
if ( isset( $filters['tribe-bar-date'] ) && isset( $filters['tribe-bar-date']['html'] ) ) $filters['tribe-bar-date']['html'] = str_replace( 'placeholder="Date"', '', $filters['tribe-bar-date']['html'] );
Does that help?