Script conflict with plugin, need to dequeue

Viewing 3 posts - 1 through 3 (of 3 total)
  • #16612
    jh0nnyrosa
    Participant

    Hi, first of all i have to thank you for this awsome theme, i’ve been using it for about a year now and i just love it. Now my question, the “fitvids” script in the theme conflicts with the “audiotube” plugin (i use it to show audio only youtube videos) so i can’t have just the audio bar on vids, i’ve talked with the plugin author and he told me to dequeue the fitvids scripts on pages that have the audiotube shortcode, using a funcion like that on theme functions.php

    // Correct Audio Tube
    add_action( ‘wp_enqueue_scripts’, ‘audiotube_deregister_scripts’ );

    function audiotube_deregister_scripts()
    {
    if ( has_shortcode( $content, ‘audiotube’ ))
    {
    wp_dequeue_script(‘fitvids’);
    }
    }

    But it not works, i guess what is wrong, im not a coder so its hard to figure out how to do this, i’ve put this code on line 72 of the functions.php.
    I’ll be glad if u guys can help me, btw my blog is http://cafecomdesenho.com, and the post where i use the shortcode is http://cafecomdesenho.com/2012/12/compositores-do-cinema-howard-shore/

    Thanks already

    #16624
    Daniel Tara
    Keymaster

    It depends what you are passing inside the $content variable. Since you are using the function outside the loop you should check that you are on a singular page and pass something like this:

    if( is_singular() ) {
    	global $post;
    	$content = apply_filters( 'the_content', $post->post_content );
    	if( has_shortcode( $content, 'audiotube' ) ) {
    		wp_dequeue_script( 'fitvids' );
    	}
    }
    #16628
    jh0nnyrosa
    Participant

    I’ve paste it like this on the same place (line 72):

    // Correct Audio Tube
    add_action( ‘wp_enqueue_scripts’, ‘audiotube_deregister_scripts’ );

    function audiotube_deregister_scripts() {
    if( is_singular() ) {
    global $post;
    $content = apply_filters( ‘the_content’, $post->post_content );
    if( has_shortcode( $content, ‘audiotube’ ) ) {
    wp_dequeue_script( ‘fitvids’ );
    }
    }
    }

    Still not working, am i missing something? This is the only code i have used on this theme, didnt change anything else. Sorry to bother you

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.