teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

コードを追記

2021/08/23 08:40

投稿

yuna_
yuna_

スコア23

title CHANGED
File without changes
body CHANGED
@@ -45,4 +45,41 @@
45
45
  }
46
46
 
47
47
  add_action( 'widgets_init', 'mytheme_widgets');
48
+ ```
49
+
50
+ ```style.css
51
+ /* サイドメニュー */
52
+ aside {
53
+ grid-row: aside;
54
+ display: grid;
55
+ grid-row-gap: 30px;
56
+ row-gap: 30px;
57
+ }
58
+
59
+ section {
60
+ border: solid 1px #ddd;
61
+ padding: 15px;
62
+ box-shadow: 0 3px 5px #ddd;
63
+ }
64
+
65
+ section h2 {
66
+ border-bottom: solid 1px #ddd;
67
+ padding-bottom: 20px;
68
+ margin-bottom: 30px;
69
+ font-size: var(--f4);
70
+ font-weight: normal;
71
+ color: #1b5e92;
72
+ text-align: center;
73
+ }
74
+
75
+ section ul {
76
+ padding: 0;
77
+ list-style-type: none;
78
+ font-size: var(--f6);
79
+ display: grid;
80
+ grid-row-gap: 15px;
81
+ row-gap: 15px;
82
+ }
83
+
84
+
48
85
  ```

2

コードの編集

2021/08/23 08:40

投稿

yuna_
yuna_

スコア23

title CHANGED
File without changes
body CHANGED
@@ -32,7 +32,8 @@
32
32
 
33
33
  ```
34
34
 
35
+
35
- ``functions.php
36
+ ```functions.php
36
37
  function mytheme_widgets() {
37
38
 
38
39
  register_sidebar( array (

1

コードを追記

2021/08/23 07:30

投稿

yuna_
yuna_

スコア23

title CHANGED
File without changes
body CHANGED
@@ -20,4 +20,28 @@
20
20
 
21
21
 
22
22
  どなたかご教授いただけると幸いです。
23
- よろしくお願いいたします。
23
+ よろしくお願いいたします。
24
+
25
+ ```sidebar.php
26
+
27
+ <?php if ( is_active_sidebar( 'sidebar-1' )): ?>
28
+ <aside>
29
+ <?php dynamic_sidebar( 'sidebar-1'); ?>
30
+ </aside>
31
+ <?php endif; ?>
32
+
33
+ ```
34
+
35
+ ``functions.php
36
+ function mytheme_widgets() {
37
+
38
+ register_sidebar( array (
39
+ 'id' => 'sidebar-1',
40
+ 'name' => 'サイドメニュー',
41
+ 'before_widget' => '<section id="%1$s" class="widget %2$s">',
42
+ 'after_widget' => '</section>'
43
+ ));
44
+ }
45
+
46
+ add_action( 'widgets_init', 'mytheme_widgets');
47
+ ```