採用サイト制作に最適なWordPressテーマ「ISSUE」の機能概要

ワードプレステーマ別

TCDテーマNEXTAGE:トップページに固定ページ表示する方法

Q.特定固定ページの内容をトップページに表示したい

A.下記のphpファイルの該当箇所を編集します

編集するテーマファイル:INDEX 固定ページテンプレート (index_template.php)

まず特定固定ページの内容を表示するために下記コードを利用します。

<?php
$page_info = get_page_by_path('固定ページのスラッグを入力');
$page = get_post($page_info);
echo $page->post_content;
?>

これを「お知らせ」を表示する部分の上や

<!-- topics -->
<div class="headline1 clearfix">
<h2><?php echo $options['index_headline_blog']; ?></h2>
<?php if ($options['blogindex_url']) : ?>
<?php if(!empty($options['older_post'])){ ?><div
class="archive_btn"><a class="blendy" href="<?php esc_attr_e(
$options['blogindex_url'] ); ?>"><?php echo $options['older_post'];
?></a></div><?php }; ?>
<?php endif; ?>
</div>
<ul class="top_list clear">
    <?php
         $args = array('post_type' => 'post', 'numberposts' => 5);
         $index_recent_post=get_posts($args);
         if ($index_recent_post) :
         foreach ($index_recent_post as $post) : setup_postdata ($post);
    ?>
<li><span><?php the_time('Y.n.j'); ?></span><a href="<?php
the_permalink() ?>"><?php the_title(); ?></a></li>
    <?php endforeach; else: ?>
<li><?php _e("There is no registered post.","tcd-w"); ?></li>
    <?php endif; ?>
</ul>
<!-- /topics -->

あるいはプレスリリースの上などに挿入してみてください。

<!-- press release -->
<div class="headline1">
<h2><?php echo $options['index_headline_news']; ?></h2>
<?php if(!empty($options['older_news'])){ ?><div
class="archive_btn"><a class="blendy" href="<?php echo
get_post_type_archive_link('press'); ?>"><?php echo
$options['older_news']; ?></a></div><?php }; ?>
</div>
<ul class="top_list clear">
    <?php
         $args = array('post_type' => 'press', 'numberposts' => 5);
         $news_post=get_posts($args);
         if ($news_post) :
         foreach ($news_post as $post) : setup_postdata ($post);
    ?>
<li><span><?php the_time('Y.n.j'); ?></span><a href="<?php
the_permalink() ?>"><?php the_title(); ?></a></li>
    <?php endforeach; else: ?>
<li><?php _e("There is no registered news.","tcd-w"); ?></li>
    <?php endif; ?>
</ul>
<!-- /press release -->

この記事は役に立ちましたか?

もし参考になりましたら、下のボタンで教えてください。
今後の記事作成の参考とさせて頂きます!

同じテーマのカスタマイズ記事