Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * JavascriptとCSSの設定
- */
- function my_scripts() {
- global $post;
- // テーマ全体で必要なJavascriptとCSS
- wp_enqueue_style( 'theme-style', get_stylesheet_uri() );
- wp_enqueue_script( 'theme-script', get_template_directory_uri() . '/js/script.js', array( 'jquery' ), '', false );
- //トップページに必要なJavascript
- if ( is_front_page() ){
- wp_enqueue_script( 'my-front-script', get_template_directory_uri() . '/js/jquery.front.js', array( 'jquery' ), '', false );
- }
- }
- add_action( 'wp_enqueue_scripts', 'my_scripts' );
- /**
- * IE9以下の設定
- */
- function my_enqueue_lt_ie9() {
- global $is_IE;
- // IEでない時はおしまい
- if ( ! $is_IE ) return;
- // 必要ならファイルをインクルード
- if ( ! function_exists( 'wp_check_browser_version' ) )
- include_once( ABSPATH . 'wp-admin/includes/dashboard.php' );
- // IEバージョンによってenqueue
- $response = wp_check_browser_version();
- if ( 0 > version_compare( intval( $response['version'] ) , 9 ) ){
- wp_enqueue_script( 'my-html5', '//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.2/html5shiv.js', array(), '', false );
- }
- }
- add_action( 'wp_enqueue_scripts', 'my_enqueue_lt_ie9' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement