https://human-relation.net/wordpress/custompost3/
カスタム投稿タイプの専用テンプレート作成方法です。
https://www.momosiri.info/cms/simplicity-post-template/ こちらも参考にさせていただきました。
(1)Simplicity2の親テーマより、以下8つのファイルを子テーマにコピペ
- 「entry-body」
- 「entry-card-content」
- 「entry-card-large」
- 「entry-card」
- 「index.php」
- 「list.php」
- 「single.php」
- 「snigle-page.php」
(2)ページ表示するために、パーマリンクを「カスタム構造」に設定
(3)準備したファイルの名前をカスタム投稿用に変更する
- 「entry-body」→(変更後)endry-body-news.php
- 「entry-card-content」→(変更後)entry-card-content-news.php
- 「entry-card-large」→(変更後)entry-card-large-news.php
- 「entry-card」→(変更後)entry-card-news.php
- 「index.php」→(変更後)archive-news.php
- 「list.php」→(変更後)list-news.php
- 「single.php」→(変更後)single-news.php
- 「snigle-page.php」→(変更後)snigle-page-news.php
※テンプレートを表示には、『Show Current Template』というプラグインを使ってます。
https://human-relation.net/wordpress/custompost4/
↑
上記ページの内容の作業にはいります。
上記8つのファイル内で、テンプレートを読み込んでいます(get_template_part())が、その読み込むテンプレートもカスタム投稿タイプに変更する必要があります。
以下の6つのファイル内のテンプレートを変更しました。
例:「get_template_part(‘entry-body’)」を「get_template_part(‘entry-body-news’)」に変更
- entry-card-large-news.php
- entry-card-news.php
- archive-news.php
- list-news.php
- single-news.php
- snigle-page-news.php
以上で、「お知らせ」の個別ページおよび一覧ページが表示できるようになりました。
個別ページは、「投稿を表示」から確認できます。
一覧ページは、管理画面の「お知らせ一覧」クリック → ページの上部「固定ページを表示」から確認できます。
この場合は、https://sweet-blog.net/news/