2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

WordPressでslick.js使った時にうまく動かない時の対処メモ

Last updated at Posted at 2020-05-29

slick.js使ってWordPressでスライダー使うっすわーと試してみたら画像は読み込まれているのにスライダーにならない・・・。
WordPressに同梱されているjqueryではなく通常のjqueryを読み込んだら解決
こいつは罠ですわ・・・


function register_jquery() {
global $pagenow;
  if (!is_admin() && $pagenow !== 'wp-login.php') {
    $script_directory = get_template_directory_uri();
    // 同梱のjqueryを読み込ませないにする
    wp_deregister_script('jquery'); 
    // 読み込ませたいjqueryをセット
    wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js', array(), NULL, true);
  // 登録したjqueryをフックさせる
    wp_enqueue_script( 'jquery' );    
  }
}
add_action('init', 'register_jquery');

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?