WordpressのTwenty Seventeenというテーマを使っています。
その中のメインインデックスのテンプレート(index.php)で表示される記事の本文だけを
非表示にしたいのですが、調べても方法がわかりません。
個別投稿などの本文は表示したままメインインデックスのテンプレートの本文だけ非表示にする方法を
教えていただけると幸いです。
「index.php」
<?php if ( have_posts() ) : /* Start the Loop */ while ( have_posts() ) : the_post(); /* * Include the Post-Format-specific template for the content. * If you want to override this in a child theme, then include a file * called content-___.php (where ___ is the Post Format name) and that will be used instead. */ get_template_part( 'template-parts/post/content', get_post_format() ); endwhile; endif; ?>
「試した事」
<div class="entry-content"> <p>3333</p> </div>
ここを
display:none;
で、非表示にしましたが、個別投稿の本文まで消えてしまいました。
また、content.phpファイルの
the_content( sprintf( __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen' ), get_the_title() ) );
この部分を削除しましたが、こちらも個別投稿の本文まで消えてしまいました。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。