質問編集履歴
1
文言修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -5,12 +5,30 @@
|
|
5
5
|
|
6
6
|
■themename/functions.phpに記述したコード
|
7
7
|
```ここに言語を入力
|
8
|
+
/*********************
|
9
|
+
CSS
|
10
|
+
*********************/
|
8
11
|
function register_style() {
|
12
|
+
wp_register_style('style', get_bloginfo('template_directory').'/style.css');
|
13
|
+
wp_register_style('woocommerce', get_bloginfo('template_directory').'/woocommerce/assets/css/woocommerce.css');
|
9
|
-
wp_register_style('woocommerce-layout', get_bloginfo('template_directory').'/woocommerce/assets/css/woocommerce-layout.css');
|
14
|
+
wp_register_style('woocommerce-layout', get_bloginfo('template_directory').'/woocommerce/assets/css/woocommerce-layout.css');
|
10
|
-
|
15
|
+
wp_register_style('shortcode', get_bloginfo('template_directory').'/library/css/shortcode.css');
|
16
|
+
wp_register_style('slider', get_bloginfo('template_directory').'/library/css/bx-slider.css');
|
17
|
+
if(!get_option( 'side_options_animatenone' )){
|
18
|
+
wp_register_style('animate', get_bloginfo('template_directory').'/library/css/animate.min.css');
|
19
|
+
}
|
20
|
+
wp_register_style('lp_css', get_bloginfo('template_directory').'/library/css/lp.css');
|
21
|
+
}
|
11
|
-
function add_stylesheet() {
|
22
|
+
function add_stylesheet() {
|
12
23
|
register_style();
|
24
|
+
wp_enqueue_style('style');
|
25
|
+
wp_enqueue_style('woocommerce');
|
13
26
|
wp_enqueue_style('woocommerce-layout');
|
27
|
+
wp_enqueue_style('slider');
|
28
|
+
wp_enqueue_style('animate');
|
29
|
+
wp_enqueue_style('shortcode');
|
30
|
+
if(is_singular( 'post_lp' )) {
|
31
|
+
wp_enqueue_style('lp_css');
|
14
32
|
}
|
15
33
|
elseif (is_home() || is_front_page()) {
|
16
34
|
}
|
@@ -18,27 +36,13 @@
|
|
18
36
|
add_action('wp_print_styles', 'add_stylesheet');
|
19
37
|
```
|
20
38
|
|
39
|
+
|
21
40
|
■同じような記述で読み込んでいるCSSファイルもある
|
22
41
|
|
23
42
|
下記のCSSのパスのものは読み込んでいます。
|
24
43
|
"/www/hogehoge/wp-content/themes/themename/woocommerce/assets/css/woocommerce.css"
|
25
44
|
|
26
|
-
■themename/functions.phpに記述したコード
|
27
45
|
|
28
|
-
```ここに言語を入力
|
29
|
-
function register_style() {
|
30
|
-
wp_register_style('woocommerce-layout', get_bloginfo('template_directory').'/woocommerce/assets/css/woocommerce.css'); }
|
31
|
-
|
32
|
-
function add_stylesheet() {
|
33
|
-
register_style();
|
34
|
-
wp_enqueue_style('woocommerce');
|
35
|
-
}
|
36
|
-
elseif (is_home() || is_front_page()) {
|
37
|
-
}
|
38
|
-
}
|
39
|
-
add_action('wp_print_styles', 'add_stylesheet');
|
40
|
-
```
|
41
|
-
|
42
46
|
■このようにプラグインであるwoocommerceのCSSを設置しようとした背景
|
43
47
|
プラグインの中にあるCSSを直接編集する手もありますが、更新がかかった時にすべて消えてしまうため、編集したいCSSだけthemenameもってきました(子テーマのイメージです)。
|
44
48
|
|