Skip to content

Commit

Permalink
jQueryファイルの読み込み関数追加
Browse files Browse the repository at this point in the history
  • Loading branch information
yhira committed Jun 14, 2018
1 parent b5dcc00 commit ede4a7b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
17 changes: 10 additions & 7 deletions lib/scripts.php
Expand Up @@ -116,15 +116,18 @@ function wp_enqueue_scripts_custom() {

//レンダリングをブロックしている jQuery, jQuery-migrate をフッタに移動する
if (!is_admin()) {
wp_deregister_script('jquery');
//wp_deregister_script('jquery-core');
wp_deregister_script('jquery-migrate');
//jQueryライブラリの読み込み
wp_enqueue_script_jquery_js();

wp_register_script('jquery', false, array('jquery-core', 'jquery-migrate'), '1.12.4', true);
wp_enqueue_script('jquery');
// wp_deregister_script('jquery');
// //wp_deregister_script('jquery-core');
// wp_deregister_script('jquery-migrate');

wp_enqueue_script('jquery-core', '//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js', array(), '1.12.4', true);
wp_enqueue_script('jquery-migrate', '//cdnjs.cloudflare.com/ajax/libs/jquery-migrate/1.4.1/jquery-migrate.min.js', array(), '1.4.1', true);
// wp_register_script('jquery', false, array('jquery-core', 'jquery-migrate'), '1.12.4', true);
// wp_enqueue_script('jquery');

// wp_enqueue_script('jquery-core', '//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js', array(), '1.12.4', true);
// wp_enqueue_script('jquery-migrate', '//cdnjs.cloudflare.com/ajax/libs/jquery-migrate/1.4.1/jquery-migrate.min.js', array(), '1.4.1', true);

//タイルカード
wp_enqueue_jquery_masonry();
Expand Down
13 changes: 13 additions & 0 deletions lib/utils.php
Expand Up @@ -246,6 +246,19 @@ function get_highlight_js_css_url(){
}
endif;

if ( !function_exists( 'wp_enqueue_script_jquery_js' ) ):
function wp_enqueue_script_jquery_js(){
wp_deregister_script('jquery');
//wp_deregister_script('jquery-core');
wp_deregister_script('jquery-migrate');

wp_register_script('jquery', false, array('jquery-core', 'jquery-migrate'), '1.12.4', true);
wp_enqueue_script('jquery');

wp_enqueue_script('jquery-core', '//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js', array(), '1.12.4', true);
wp_enqueue_script('jquery-migrate', '//cdnjs.cloudflare.com/ajax/libs/jquery-migrate/1.4.1/jquery-migrate.min.js', array(), '1.4.1', true);
}
endif;

//ソースコードのハイライト表示に必要なリソースの読み込み
if ( !function_exists( 'wp_enqueue_highlight_js' ) ):
Expand Down

0 comments on commit ede4a7b

Please sign in to comment.