WordPress.org

Make WordPress Core

Ticket #21480: fitvids2.diff

File fitvids2.diff, 1.8 KB (added by rfair404, 11 months ago)

Don't target #main on fitvids

  • wp-content/themes/twentytwelve/js/theme.js

     
    3838                        } 
    3939                }, 200 ); 
    4040        } ); 
     41 
     42        $('.responsive-video').fitVids(); 
    4143} ); 
     44 No newline at end of file 
  • wp-content/themes/twentytwelve/functions.php

     
    101101                wp_enqueue_script( 'comment-reply' ); 
    102102 
    103103        /** 
     104         * FitVids adds responsiveness for videos. 
     105         */ 
     106        wp_enqueue_script( 'twentytwelve-fitvids', get_template_directory_uri() . '/js/fitvids.js', array( 'jquery' ), '20120802', true ); 
     107 
     108        /** 
    104109         * JavaScript for handling navigation menus and the resized 
    105110         * styles for small screen sizes. 
    106111         */ 
    107         wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/theme.js', array( 'jquery' ), '20120802', true ); 
     112        wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/theme.js', array( 'jquery', 'twentytwelve-fitvids' ), '20120802', true ); 
    108113 
    109114        /** 
    110115         * Load special font CSS file. 
     
    164169add_filter( 'wp_title', 'twentytwelve_wp_title', 10, 2 ); 
    165170 
    166171/** 
     172 * Add post class responsive-video that fitvids can target 
     173 * 
     174 * @since Twenty Twelve 1.0 
     175 */ 
     176function twentytwelve_responsive_video_post_class($classes){ 
     177        $classes[] = 'responsive-video'; 
     178        return $classes; 
     179} 
     180add_filter('post_class', 'twentytwelve_responsive_video_post_class'); 
     181 
     182/** 
    167183 * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link. 
    168184 * 
    169185 * @since Twenty Twelve 1.0