質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
jQueryプラグイン

jQueryの拡張機能。 様々な種類があり、その数は膨大です。公開済みのプラグインの他にも、自作することもできます。 jQueryで利用できるようにしておくだけで、導入およびカスタマイズが比較的容易に行なえます。

WordPress

WordPressは、PHPで開発されているオープンソースのブログソフトウェアです。データベース管理システムにはMySQLを用いています。フリーのブログソフトウェアの中では最も人気が高く、PHPとHTMLを使って簡単にテンプレートをカスタマイズすることができます。

Q&A

0回答

458閲覧

wordpressにjQueryプラグインの「slick」を導入したい

退会済みユーザー

退会済みユーザー

総合スコア0

jQueryプラグイン

jQueryの拡張機能。 様々な種類があり、その数は膨大です。公開済みのプラグインの他にも、自作することもできます。 jQueryで利用できるようにしておくだけで、導入およびカスタマイズが比較的容易に行なえます。

WordPress

WordPressは、PHPで開発されているオープンソースのブログソフトウェアです。データベース管理システムにはMySQLを用いています。フリーのブログソフトウェアの中では最も人気が高く、PHPとHTMLを使って簡単にテンプレートをカスタマイズすることができます。

0グッド

0クリップ

投稿2017/12/20 00:39

###前提・実現したいこと
はじめまして。閲覧ありがとうございます。
wordpress・php初心者のeteGmtweと申します。
wordpressにjQueryプラグインの「slick」を導入したいと考えております。
表示させたいページはfrontpageになります。
slickとはこちらのサイトのjQueryプラグインです。(http://kenwheeler.github.io/slick/)
wodpressには「Moesia」というテンプレートを使用しています。(https://athemes.com/theme/moesia/)
どなた様か教えて頂けませんでしょうか。

###発生している問題
slickのサイトからデータをダウンロードし、wordpressにアップロードしました。
その後、functions.phpにslickのjsを読み込むソースコードをすでに記入してあるコードから推測し、
記入してみたのですが、動作しませんでした。
php・wordpress共に初心者ですのでコードが誤っていると思います。

###functions.php(文字数制限のため何箇所か削っています)

php

1<?php 2/** 3 * Moesia functions and definitions 4 * 5 * @package Moesia 6 */ 7 8 9if ( ! function_exists( 'moesia_setup' ) ) : 10/** 11 * Sets up theme defaults and registers support for various WordPress features. 12 * 13 * Note that this function is hooked into the after_setup_theme hook, which 14 * runs before the init hook. The init hook is too late for some features, such 15 * as indicating support for post thumbnails. 16 */ 17function moesia_setup() { 18 19/** 20 * Enqueue scripts and styles. 21 */ 22function moesia_scripts() { 23 24 wp_enqueue_style( 'moesia-style', get_stylesheet_uri() ); 25 26 if ( ! function_exists('moesia_fonts_extended') ) { //Check that the Moesia Fonts extension is not active 27 //Load the fonts 28 $headings_font = esc_html(get_theme_mod('headings_fonts')); 29 $body_font = esc_html(get_theme_mod('body_fonts')); 30 if( $headings_font ) { 31 wp_enqueue_style( 'moesia-headings-fonts', '//fonts.googleapis.com/css?family='. $headings_font ); 32 } else { 33 wp_enqueue_style( 'moesia-roboto-condensed', '//fonts.googleapis.com/css?family=Roboto+Condensed:700'); 34 } 35 if( $body_font ) { 36 wp_enqueue_style( 'moesia-body-fonts', '//fonts.googleapis.com/css?family='. $body_font ); 37 } else { 38 wp_enqueue_style( 'moesia-roboto', '//fonts.googleapis.com/css?family=Roboto:400,400italic,700,700italic'); 39 } 40 } 41 42 wp_enqueue_style( 'moesia-font-awesome', get_template_directory_uri() . '/fonts/font-awesome.min.css' ); 43 44 wp_enqueue_script( 'moesia-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true ); 45 46 wp_enqueue_script( 'moesia-waypoints', get_template_directory_uri() . '/js/waypoints.min.js', array('jquery'), true ); 47 48 if ( is_page_template('page_front-page.php') ) { 49 50 wp_enqueue_script( 'moesia-carousel', get_template_directory_uri() . '/js/slick.min.js', array( 'jquery' ), true ); 51 52 wp_enqueue_script( 'moesia-carousel-init', get_template_directory_uri() . '/js/carousel-init.js', array(), true ); 53 54 wp_enqueue_style( 'moesia-pretty-photo', get_template_directory_uri() . '/inc/prettyphoto/css/prettyPhoto.min.css' ); 55 56 wp_enqueue_script( 'moesia-pretty-photo-js', get_template_directory_uri() . '/inc/prettyphoto/js/jquery.prettyPhoto.min.js', array(), true ); 57 58 wp_enqueue_script( 'moesia-pretty-photo-init', get_template_directory_uri() . '/inc/prettyphoto/js/prettyphoto-init.js', array(), true ); 59 60 } 61 62 if ( get_theme_mod('moesia_animate') != true ) { 63 64 wp_enqueue_script( 'moesia-wow', get_template_directory_uri() . '/js/wow.min.js', array( 'jquery' ), true ); 65 66 wp_enqueue_style( 'moesia-animations', get_template_directory_uri() . '/css/animate/animate.min.css' ); 67 68 wp_enqueue_script( 'moesia-wow-init', get_template_directory_uri() . '/js/wow-init.js', array( 'jquery' ), true ); 69 70 } 71 72 wp_enqueue_script( 'moesia-sticky', get_template_directory_uri() . '/js/jquery.sticky.js', array(), true ); 73 74 wp_enqueue_script( 'moesia-scripts', get_template_directory_uri() . '/js/scripts.js', array('jquery'), true ); 75 76 wp_enqueue_script( 'moesia-fitvids', get_template_directory_uri() . '/js/jquery.fitvids.js', array('jquery'), true ); 77 78 wp_enqueue_script( 'moesia-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true ); 79 80 if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { 81 wp_enqueue_script( 'comment-reply' ); 82 } 83 84 if ( is_home() && get_theme_mod('blog_layout') == 'masonry' ) { 85 wp_enqueue_script( 'moesia-masonry-init', get_template_directory_uri() . '/js/masonry-init.js', array('masonry'), true ); 86 } 87 88} 89add_action( 'wp_enqueue_scripts', 'moesia_scripts' ); 90 91/ 92 * Load html5shiv 93 */ 94function moesia_html5shiv() { 95 echo '<!--[if lt IE 9]>' . "\n"; 96 echo '<script src="' . esc_url( get_template_directory_uri() . '/js/html5shiv.js' ) . '"></script>' . "\n"; 97 echo '<![endif]-->' . "\n"; 98} 99add_action( 'wp_head', 'moesia_html5shiv' ); 100 101/** 102 * Change the excerpt length 103 */ 104function moesia_excerpt_length( $length ) { 105 106 $excerpt = get_theme_mod('exc_lenght', '30'); 107 return $excerpt; 108 109} 110add_filter( 'excerpt_length', 'moesia_excerpt_length', 999 ); 111 112

###試したこと
frontpageに記入したいのでif ( is_page_template('page_front-page.php') ) {
の中に以下のようなコードを記入しました。

wp_enqueue_script( get_template_directory_uri() . '/js/slick.min.js', array( 'jquery' ), true ); wp_enqueue_script( get_template_directory_uri() . '/js/slick.js', array( 'jquery' ), true );

###固定ページ(スライド部分の記載)

<!-- スライド --> <div class="slider slick-slider"> <div><img src="/wp-content/uploads/2017/12/auto1.png"></div> <div><img src="/wp-content/uploads/2017/12/auto2.png"></div> <div><img src="/wp-content/uploads/2017/12/auto3.png"></div> </div>

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問