質問編集履歴
2
kei344 さま。投稿方法について教えてくださってありがとうございます。bxsliderの記述は誤入力でした。bxsliderについての記述はどこにもございません
title
CHANGED
File without changes
|
body
CHANGED
@@ -13,8 +13,9 @@
|
|
13
13
|
```
|
14
14
|
|
15
15
|
###該当のソースコード
|
16
|
-
|
16
|
+
|
17
17
|
footer.phpの</body>の前にカプセル化したjQueryの記述をした。
|
18
|
+
```jquery
|
18
19
|
<script type="text/javascript">
|
19
20
|
jQuery(function ($) {
|
20
21
|
$('.center-item').slick({ //*この行にconsoleログでエラーが返されています。
|
@@ -34,30 +35,27 @@
|
|
34
35
|
});
|
35
36
|
|
36
37
|
</script>
|
38
|
+
|
37
39
|
```
|
38
40
|
|
39
41
|
###試したこと
|
40
42
|
当初Wordpress内のjQueryを使って動作させるようにしていたのですが、エラーが出ていたので、WordPress本体とは違うバージョンのjQueryを指定するため、以下の記述をfunctions.phpに加えた。
|
41
|
-
function my_scripts_method() {
|
42
|
-
wp_deregister_script('jquery');
|
43
|
-
wp_enqueue_script('jquery','https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js', array(), '1.11.3');
|
44
|
-
wp_enqueue_script('bxSlider', get_settings('site_url').'/wp-content/themes/your-theme/js/jquery.bxslider.min.js', array('jquery'), '4.1.2', true);
|
45
|
-
}
|
46
|
-
add_action( 'wp_enqueue_scripts', 'my_scripts_method' );
|
47
|
-
|
48
|
-
###補足情報(言語/FW/ツール等のバージョンなど)
|
49
|
-
|
43
|
+
```phpで記述いたします
|
50
44
|
<?php
|
51
45
|
function my_scripts_method() {
|
52
46
|
wp_deregister_script('jquery');
|
53
47
|
wp_enqueue_script('jquery','https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js', array(), '1.12.2');
|
54
|
-
wp_enqueue_script('slick', get_settings('site_url').'/wp-content/themes/
|
48
|
+
wp_enqueue_script('slick', get_settings('site_url').'/wp-content/themes/theme_name/js/slick.min.js', array('jquery'), '1.5.9', true);
|
55
49
|
}
|
56
50
|
add_action( 'wp_enqueue_scripts', 'my_scripts_method' );
|
57
51
|
add_theme_support('post-thumbnails');
|
58
52
|
?>
|
53
|
+
```
|
54
|
+
|
55
|
+
###補足情報(言語/FW/ツール等のバージョンなど)
|
59
|
-
|
56
|
+
header.phpの<head></head>の中の部分を記載します。
|
60
57
|
あわせてご覧いただければ幸いです。
|
58
|
+
```html,php
|
61
59
|
<head>
|
62
60
|
<meta charset="utf-8">
|
63
61
|
<title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> » Blog Archive <?php } ?> <?php wp_title(); ?></title>
|
@@ -72,4 +70,5 @@
|
|
72
70
|
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
|
73
71
|
|
74
72
|
<?php wp_head(); ?>
|
75
|
-
</head>
|
73
|
+
</head>
|
74
|
+
```
|
1
header\.php内<head></head>の部分を追記しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -55,4 +55,21 @@
|
|
55
55
|
}
|
56
56
|
add_action( 'wp_enqueue_scripts', 'my_scripts_method' );
|
57
57
|
add_theme_support('post-thumbnails');
|
58
|
-
?>
|
58
|
+
?>
|
59
|
+
追記: header.phpの<head></head>の中の部分を記載します。
|
60
|
+
あわせてご覧いただければ幸いです。
|
61
|
+
<head>
|
62
|
+
<meta charset="utf-8">
|
63
|
+
<title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> » Blog Archive <?php } ?> <?php wp_title(); ?></title>
|
64
|
+
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSSフィード" href="<?php bloginfo('rss2_url'); ?>">
|
65
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
66
|
+
<!-- External files -->
|
67
|
+
<link href="<?php echo get_stylesheet_uri(); ?>" rel="stylesheet" type="text/css">
|
68
|
+
<link href="<?php echo get_template_directory_uri(); ?>/css/slick.css" type="text/css" media="screen">
|
69
|
+
<link href="<?php echo get_template_directory_uri(); ?>/css/slick-theme.css" type="text/css" media="screen">
|
70
|
+
<!-- Favicon, Thumbnail image -->
|
71
|
+
<link rel="shortcut icon" href="<?php bloginfo('template_url'); ?>/images/favicon.ico">
|
72
|
+
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
|
73
|
+
|
74
|
+
<?php wp_head(); ?>
|
75
|
+
</head>
|