Created
June 28, 2014 10:56
-
-
Save hitsujixgit/577a139ab665e44e763d to your computer and use it in GitHub Desktop.
特定のテンプレートに記事を挿入する - 実践的テーマを作成する #6
コードの一部のみ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(have_posts()) { | |
echo '<h2 class="post-title">'.$title.'</h2>'; | |
// 固定ページ "category-information-acquisition" の本文を挿入する | |
$cat_discription_page = get_page_by_path('category-information-acquisition'); | |
if(isset($cat_discription_page)) { | |
echo '<div class="post-content">'.apply_filters('the_content', $cat_discription_page->post_content).'</div><hr />'; | |
} | |
while(have_posts()) { | |
the_post(); | |
get_template_part('content','excerpt'); | |
} | |
get_template_part('pagination','pages'); | |
} else { | |
echo '<p>該当する記事がありません</p>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment