Tribe Bar Day View Displaying Multiple Times

Home Forums Calendar Products Filter Bar Tribe Bar Day View Displaying Multiple Times

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #989288
    Ryan
    Participant

    Hello there,

    Following up on this thread which you guys were very helpful with:

    Scroll To Div on Filter 'View As' Change

    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)

    #989515
    Nico
    Member

    Hi 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,
    Nico

    #989531
    Ryan
    Participant

    Hey 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

    #989745
    Ryan
    Participant

    Good 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
    #990155
    Nico
    Member

    Hey 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,
    Nico

    #990306
    Ryan
    Participant

    You’re the man. Worked like a charm. Thanks Nico – much appreciated.

    #990727
    Nico
    Member

    Hey 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

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Tribe Bar Day View Displaying Multiple Times’ is closed to new replies.