Home › Forums › Calendar Products › Filter Bar › Tribe Bar Day View Displaying Multiple Times
- This topic has 6 replies, 2 voices, and was last updated 10 years, 8 months ago by
Nico.
-
AuthorPosts
-
July 23, 2015 at 6:06 am #989288
Ryan
ParticipantHello there,
Following up on this thread which you guys were very helpful with:
We’ve decided to enable all views instead of just month, photo and map. All is well except when we switch to ‘Day’ view. The view itself looks fine, but in the Tribe Bar, instead of it just showing ‘Day View’ and allowing us to change views, it show an open list of ‘Day View’ three times and won’t let us change view.
This only happens when we switch to ‘Day View’. When I remove the modification made in the thread referenced above it works properly.
Any suggestions?
Thanks!
Matt (Ryan’s Developer)
July 23, 2015 at 10:37 am #989515Nico
MemberHi Matt,
Thanks for reaching out to us! I’ll try to help you out fixing this -rather strange- issue!
From what I’m seeing in the source code ‘tribe-events-bar.min.js’ is getting included twice -both the ‘original’ script and your modified copy- in day view. So I’m guessing the script dequeue is not working properly there.
Can you paste the actual code you are using to dequeue the script?
Best,
NicoJuly 23, 2015 at 10:58 am #989531Ryan
ParticipantHey Nico,
Thanks for the help. Here is the function I’m using to dequeue the script and the enqueue the modified version. Obviously you can ignore the reference to google fonts and font icons.
add_action( 'wp_enqueue_scripts', 'mw_enqueue_fonts' ); function mw_enqueue_fonts() { wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Lato:100,300,400,700,100italic,300italic,400italic,700italic|Roboto:400,700,500italic,500,400italic,300italic,300,100italic,100', array(), CHILD_THEME_VERSION ); wp_enqueue_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css', array(), CHILD_THEME_VERSION ); wp_dequeue_script( 'tribe-events-bar' ); if ( tribe_is_month() || tribe_is_map() || tribe_is_photo() || tribe_is_day() || tribe_is_week() || tribe_is_list_view() ) { wp_enqueue_script( 'pondhole-tribe-events-bar', get_stylesheet_directory_uri() . '/js/tribe-events-bar.min.js', array( 'jquery' ) ); } }Thanks!
Matt
July 23, 2015 at 5:35 pm #989745Ryan
ParticipantGood catch on it not dequeueing properly in the ‘day view’. Just as a test I renamed the tribe-events-bar.js and tribe-events-bar.min.js in the plugin so it couldn’t load that file and it then works properly (even though there is a console error since there is a file missing). So, for whatever reason the dequeue is not working properly in day view.
Interesting behavior. Any help would be great!
Note – I’ve put the file names back to normal so it is currently in the ‘non-working’ state.
Thanks,
Matt
-
This reply was modified 10 years, 8 months ago by
Ryan. Reason: Make sure you are aware that I've renamed the files back to normal
July 24, 2015 at 3:11 pm #990155Nico
MemberHey Matt,
Thanks for the follow-up! This one was a tricky one to get sorted I must say.
The thing is that ‘tribe-events-ajax-day’ script sets ‘tribe-events-bar’ as dependency, so that why it got in there anyway! I included the dependency clean up in this modified version of your script. PLease try it out and let me know if it works.
add_action( 'wp_enqueue_scripts', 'mw_enqueue_fonts' );
function mw_enqueue_fonts() {
wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Lato:100,300,400,700,100italic,300italic,400italic,700italic|Roboto:400,700,500italic,500,400italic,300italic,300,100italic,100', array(), CHILD_THEME_VERSION );
wp_enqueue_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css', array(), CHILD_THEME_VERSION );
if ( tribe_is_day() ) {
global $wp_scripts;
$wp_scripts->registered['tribe-events-ajax-day']->deps = array();
}
wp_dequeue_script( 'tribe-events-bar' );
if ( tribe_is_month() || tribe_is_map() || tribe_is_photo() || tribe_is_day() || tribe_is_week() || tribe_is_list_view() ) {
wp_enqueue_script( 'pondhole-tribe-events-bar', get_stylesheet_directory_uri() . '/js/tribe-events-bar.min.js', array( 'jquery' ) );
}
}
Have a great weekend,
Best,
NicoJuly 25, 2015 at 5:24 pm #990306Ryan
ParticipantYou’re the man. Worked like a charm. Thanks Nico – much appreciated.
July 27, 2015 at 2:13 pm #990727Nico
MemberHey Matt,
Thanks for the compliments buddy, really happy to hear this worked! I have to admit I pinged the dev team for an opinion on this one 😉
I’ll go ahead and close out this thread, but if you need help with anything else please don’t hesitate to create a new one and we will be happy to help.
Best of luck with the project,
Keep on rocking!
Nico -
This reply was modified 10 years, 8 months ago by
-
AuthorPosts
- The topic ‘Tribe Bar Day View Displaying Multiple Times’ is closed to new replies.
