質問編集履歴

1

メインループ箇所追加、mainSidebar.php呼び出し箇所追加

2017/12/01 04:09

投稿

yuyauver98
yuyauver98

スコア14

test CHANGED
File without changes
test CHANGED
@@ -16,7 +16,9 @@
16
16
 
17
17
  ###該当のソースコード
18
18
 
19
- ```mainSidebar.php
19
+ mainSidebar.php
20
+
21
+ ```
20
22
 
21
23
  <h2 class="mainSiderbarTitle">編集部おすすめ</h2>
22
24
 
@@ -102,9 +104,109 @@
102
104
 
103
105
  ```
104
106
 
105
-
107
+ index.php メインループ↓
108
+
106
-
109
+ ```
110
+
107
-
111
+ <!-- ********************************************************************
112
+
113
+ * 記事一覧
114
+
115
+ ********************************************************************** -->
116
+
117
+ <!-- 11/23 -->
118
+
119
+ <?php if(is_paged()) : ?>
120
+
121
+ <ul>
122
+
123
+
124
+
125
+ <?php if (have_posts()) : ?>
126
+
127
+ <?php while (have_posts()) : the_post(); ?>
128
+
129
+ <li class="flex-fluid justify-start item-start link frontPostArea">
130
+
131
+ <a href="<?php the_permalink(); ?>">
132
+
133
+ <figure class="frontPostIconArea">
134
+
135
+ <?php
136
+
137
+ $img = get_field('postIcon');
138
+
139
+ $imgurl = wp_get_attachment_image_src($img, 'full');
140
+
141
+ ?>
142
+
143
+ <?php the_post_thumbnail('medium'); ?>
144
+
145
+ </figure>
146
+
147
+ </a>
148
+
149
+
150
+
151
+ <div class="frontPostItem">
152
+
153
+ <a href="<?php the_permalink(); ?>">
154
+
155
+ <h3 class="frontPostTitle">
156
+
157
+ <?php the_title(); ?>
158
+
159
+ </h3>
160
+
161
+ </a>
162
+
163
+
164
+
165
+ <a href="<?php the_permalink(); ?>">
166
+
167
+ <div class="frontPostSummary">
168
+
169
+ <?php echo get_the_content(); ?>
170
+
171
+ </div>
172
+
173
+ </a>
174
+
175
+
176
+
177
+ <span class="frontPostTag">
178
+
179
+ <?php the_category(); ?>
180
+
181
+ </span>
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+ </div>
190
+
191
+ </li>
192
+
193
+ <?php endwhile; endif; ?>
194
+
195
+ </ul>
196
+
197
+ ```
198
+
199
+ index.php mainSidebar.php呼び出し部分↓
200
+
201
+ ```
202
+
203
+ <section class="col-sm-12 sp-lg-4" id="rightSidebarSection">
204
+
205
+ <?php get_template_part("./template/mainSidebar"); ?>
206
+
207
+ </section>
208
+
209
+ ```
108
210
 
109
211
  ###補足情報(言語/FW/ツール等のバージョンなど)
110
212
 
@@ -119,3 +221,7 @@
119
221
 
120
222
 
121
223
  管理画面の表示設定では最大投稿数を20に設定しています。
224
+
225
+
226
+
227
+ index.phpでmainSidebar.phpをget_template_part()を使って呼び出しています。