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

質問編集履歴

2

style.cssの「site-main」の記載がある部分を追記しました

2020/10/19 14:01

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -185,4 +185,123 @@
185
185
  ?>
186
186
 
187
187
  </article><!-- #post-<?php the_ID(); ?> -->
188
+ ```
189
+
190
+ ```
191
+ //style.cssの「site-main」に関連した部分のみ抜粋:その1
192
+
193
+ /* Blog landing, search, archives */
194
+
195
+ .blog .site-main > article,
196
+ .archive .site-main > article,
197
+ .search .site-main > article {
198
+ padding-bottom: 1em;
199
+ }
200
+
201
+ body:not(.twentyseventeen-front-page) .entry-header {
202
+ padding: 1em 0;
203
+ }
204
+
205
+ body:not(.twentyseventeen-front-page) .entry-header,
206
+ body:not(.twentyseventeen-front-page) .entry-content,
207
+ body:not(.twentyseventeen-front-page) #comments {
208
+ margin-left: auto;
209
+ margin-right: auto;
210
+ }
211
+
212
+ body:not(.twentyseventeen-front-page) .entry-header {
213
+ padding-top: 0;
214
+ }
215
+
216
+ .blog .entry-meta a.post-edit-link,
217
+ .archive .entry-meta a.post-edit-link,
218
+ .search .entry-meta a.post-edit-link {
219
+ color: #222;
220
+ display: inline-block;
221
+ margin-left: 1em;
222
+ white-space: nowrap;
223
+ }
224
+
225
+ .search .page .entry-meta a.post-edit-link {
226
+ margin-left: 0;
227
+ white-space: nowrap;
228
+ }
229
+
230
+ .taxonomy-description {
231
+ color: #666;
232
+ font-size: 13px;
233
+ font-size: 0.8125rem;
234
+ }
235
+
236
+ ////////////////////
237
+ //style.cssの「site-main」に関連した部分のみ抜粋:その2
238
+ /* Blog, archive, search */
239
+
240
+ .sticky .icon-thumb-tack {
241
+ height: 23px;
242
+ left: -2.5em;
243
+ top: 1.5em;
244
+ width: 32px;
245
+ }
246
+
247
+ body:not(.has-sidebar):not(.page-one-column) .page-header,
248
+ body.has-sidebar.error404 #primary .page-header,
249
+ body.page-two-column:not(.archive) #primary .entry-header,
250
+ body.page-two-column.archive:not(.has-sidebar) #primary .page-header {
251
+ float: left;
252
+ width: 36%;
253
+ }
254
+
255
+ .blog:not(.has-sidebar) #primary article,
256
+ .archive:not(.page-one-column):not(.has-sidebar) #primary article,
257
+ .search:not(.has-sidebar) #primary article,
258
+ .error404:not(.has-sidebar) #primary .page-content,
259
+ .error404.has-sidebar #primary .page-content,
260
+ body.page-two-column:not(.archive) #primary .entry-content,
261
+ body.page-two-column #comments {
262
+ float: right;
263
+ width: 58%;
264
+ }
265
+
266
+ .blog .site-main > article,
267
+ .archive .site-main > article,
268
+ .search .site-main > article {
269
+ padding-top: 4em;
270
+ padding-bottom: 4em;
271
+ }
272
+
273
+ .navigation.pagination {
274
+ clear: both;
275
+ float: right;
276
+ width: 58%;
277
+ }
278
+
279
+ .has-sidebar .navigation.pagination,
280
+ .archive.page-one-column:not(.has-sidebar) .navigation.pagination {
281
+ float: none;
282
+ width: 100%;
283
+ }
284
+
285
+ .entry-footer {
286
+ display: table;
287
+ width: 100%;
288
+ }
289
+
290
+ .entry-footer .cat-tags-links {
291
+ display: table-cell;
292
+ vertical-align: middle;
293
+ width: 100%;
294
+ }
295
+
296
+ .entry-footer .edit-link {
297
+ display: table-cell;
298
+ text-align: right;
299
+ vertical-align: middle;
300
+ }
301
+
302
+ .entry-footer .edit-link a.post-edit-link {
303
+ margin-top: 0;
304
+ margin-left: 1em;
305
+ }
306
+
188
307
  ```

1

single.php、content.phpを追記しました。

2020/10/19 14:01

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -74,4 +74,115 @@
74
74
 
75
75
  <?php
76
76
  get_footer();
77
+ ```
78
+
79
+
80
+
81
+ ```
82
+ //個別投稿のテーマファイル:single.phpの内容
83
+ <?php
84
+ get_header(); ?>
85
+
86
+ <div class="wrap">
87
+ <div id="primary" class="content-area">
88
+
89
+ <main id="main" class="site-main" role="main">
90
+
91
+ <?php
92
+ // Start the Loop.
93
+ while ( have_posts() ) :
94
+ the_post();
95
+
96
+ get_template_part( 'template-parts/post/content', get_post_format() );
97
+
98
+ //いいねボタン
99
+ if(function_exists('the_ratings')) { the_ratings(); }
100
+
101
+ // If comments are open or we have at least one comment, load up the comment template.
102
+ if ( comments_open() || get_comments_number() ) :
103
+ comments_template();
104
+ endif;
105
+ endwhile; // End the loop.
106
+ ?>
107
+    
108
+ </main><!-- #main -->
109
+ <a href= "http://onetokyo.fem.jp/" >一覧に戻る</a>
110
+ </div><!-- #primary -->
111
+ <!-- <?php get_sidebar(); ?>
112
+ </div><!-- .wrap -->
113
+
114
+ <?php
115
+ get_footer();
116
+ ```
117
+
118
+ ```
119
+ //個別投稿のテンプレートファイル:content.php (template-parts/post/content.php)
120
+
121
+ <?php
122
+
123
+ <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
124
+ <?php
125
+ if ( is_sticky() && is_home() ) :
126
+ echo twentyseventeen_get_svg( array( 'icon' => 'thumb-tack' ) );
127
+ endif;
128
+ ?>
129
+ <header class="entry-header">
130
+ <?php
131
+ if ( 'post' === get_post_type() ) {
132
+ echo '<div class="entry-meta">';
133
+ if ( is_single() ) {
134
+ twentyseventeen_posted_on();
135
+ } else {
136
+ echo twentyseventeen_time_link();
137
+ twentyseventeen_edit_link();
138
+ };
139
+ echo '</div><!-- .entry-meta -->';
140
+ };
141
+
142
+ if ( is_single() ) {
143
+ the_title( '<h1 class="entry-title">', '</h1>' );
144
+ } elseif ( is_front_page() && is_home() ) {
145
+ the_title( '<h3 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h3>' );
146
+ } else {
147
+ the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
148
+ }
149
+ ?>
150
+ </header><!-- .entry-header -->
151
+
152
+ <?php if ( '' !== get_the_post_thumbnail() && ! is_single() ) : ?>
153
+ <div class="post-thumbnail">
154
+ <a href="<?php the_permalink(); ?>">
155
+ <?php the_post_thumbnail( 'twentyseventeen-featured-image' ); ?>
156
+ </a>
157
+ </div><!-- .post-thumbnail -->
158
+ <?php endif; ?>
159
+
160
+ <div class="entry-content">
161
+ <?php
162
+ the_content(
163
+ sprintf(
164
+ /* translators: %s: Post title. */
165
+ __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen' ),
166
+ get_the_title()
167
+ )
168
+ );
169
+
170
+ wp_link_pages(
171
+ array(
172
+ 'before' => '<div class="page-links">' . __( 'Pages:', 'twentyseventeen' ),
173
+ 'after' => '</div>',
174
+ 'link_before' => '<span class="page-number">',
175
+ 'link_after' => '</span>',
176
+ )
177
+ );
178
+ ?>
179
+ </div><!-- .entry-content -->
180
+
181
+ <?php
182
+ if ( is_single() ) {
183
+ twentyseventeen_entry_footer();
184
+ }
185
+ ?>
186
+
187
+ </article><!-- #post-<?php the_ID(); ?> -->
77
188
  ```