カスタム投稿タイプ表示用のテンプレートを作成したのに、なぜかindex.php
-
現在WordPressを用いてブログを作っています。fumiyasacと申します。
現在、カスタム投稿タイプ(portfolioいう名前)を作成して、PORTFOLIOという固定ページを作成し、ページテンプレート(page-portfolio.php)にて、カスタム投稿タイプの一覧を表示しようと思ったのですが、なぜかindex.phpが呼ばれてしまいます。
管理画面右にある「ページ属性」の部分でもpage-portfolio.phpを選択しているのにも関わらず、このような状態になっていますので、解決策が見つからずに困っています。
ご回答頂ければ幸いです。
<管理画面での入力内容>
固定ページの部分にはPORTFOLIOとタイトルを入れて、内容は空にしてあります。<page-portfolio.php>
<?php /* Template Name:ポートフォリオの一覧ページ用テンプレート */ ?> <?php get_header(); ?> <!-- subNavigation #start --> <div class="boxL" id="leftColmn"> <?php get_sidebar(); ?> </div> <!-- subNavigation #end --> <div class="boxR" id="rightColmn"> <!-- blogEntry #start --> <article id="blogPage"> <!--this is portfolio page --> <!-- if you need to loop, please write code here #start --> <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $myQuery = new WP_Query(); $param = array( 'paged' => $paged, 'posts_per_page' => '1', 'post_type' => 'portfolio', 'post_status' => 'publish', 'orderby' => 'date', 'order' => 'DESC' ); $myQuery->query($param); ?> <?php if($myQuery->have_posts()): while($myQuery->have_posts()): $myQuery->the_post(); ?> <section class="articleArea" id="post-<?php echo $post->ID; ?>"> <h1 class="articleAreaTitle"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1> <div class="articleAreaData magt10 padb20 clearfix"> <!-- insert enrty or page here --> <div class="boxL" id="categoryBox"> <span class="categoryTitle">Portfolio Category:</span> <?php echo get_the_term_list( $post->ID, 'portfolio-category', '', '', '' ); ?> </div> <div class="boxR" id="dateBox"> <span class="dateTitle">Posted:</span> <?php echo get_the_date(); ?> </div> </div> <div class="articleImpl magt15"> <?php the_content(); ?> </div> </section> <?php endwhile; endif; ?> <!-- if you need to loop, please write code here #end --> </article> <!-- blogEntry #end --> </div> <?php get_footer(); ?>
2件の返信を表示中 - 1 - 2件目 (全2件中)
2件の返信を表示中 - 1 - 2件目 (全2件中)
- トピック「カスタム投稿タイプ表示用のテンプレートを作成したのに、なぜかindex.php」には新たに返信することはできません。