WordPress.org

Support

Support » Plugins and Hacks » Hacks » Functions.php in child theme causes Widget Page to be unresponsive

Functions.php in child theme causes Widget Page to be unresponsive

  • Below is the code I have in functions.php in my child theme wrapped with php tags. This fixes an issue with youtube video z-index in chrome and it is working. However, it seems to cause an issue on my widget page which remains unresponsive (unable to drag and edit) once this functions.php file is inserted in the child theme.

    Am I doing anything wrong? Someone suggested it might be some script taking too much time to load. Would appreciate any input. Thanks!

    Code in functions.php:

    /* Fix Youtube videos Overlay */
    	function add_my_scripts(){
    		wp_deregister_script( 'jquery' );
    		wp_register_script( 'jquery', 'http://code.jquery.com/jquery-1.7.min.js', false, '1.7', true);
    		wp_enqueue_script( 'jquery' );
    		wp_register_script( 'Youtubefix', get_bloginfo('stylesheet_directory').'/assets/javascripts/jquery.youtubefix.js', false, null, true);
    		wp_enqueue_script('Youtubefix');
    }
    	add_action('init', 'add_my_scripts');

    Code in the .js itself:

    $(document).ready(function ()
     {$('iframe').each(function()
         {var url = $(this).attr("src");
          var result = url.search(/youtube/i);
          if(result!=-1)
           {result = url.indexOf('?');
            if(result!=-1)
              {$(this).attr("src",url+"&wmode=transparent");
              } else {$(this).attr("src",url+"?wmode=transparent");}
           }
         });
     });
  • The topic ‘Functions.php in child theme causes Widget Page to be unresponsive’ is closed to new replies.
Skip to toolbar