我想顯示一個特定的帖子類型依賴於頁面,所以例如我有一個博客帖子類型,我想表明,當用戶在/博客,我有鏈接帖子類型,並希望在用戶處於/鏈接時顯示這些內容。這是可能目前我在index.php中有這樣的代碼WordPress的幫助顯示帖子類別依賴於頁面
<?php get_header(); ?>
<div id="content"><!-- CONTENT START -->
<h2><?php echo ucwords($post->post_title);?></h2>
<div id="subNavigation"><!-- SUBNAV START -->
<?php
if(get_the_title($post->post_parent) == "Members Content") {
$children .= '<li><a href="forums">Forums</a></li>';
$children .= '<li><a href="members">Members</a></li>';
$children .= '<li><a href="groups">Groups</a></li>';
} else {
$permalink = get_permalink($post->post_parent);
$children .= '<li><a href="'.$permalink.'">'. get_the_title($post->post_parent). '</a></li>';
}
if($post->post_parent)
$children .= wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
else
$children .= wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
if ($children) { ?>
<ul>
<?php echo $children; ?>
</ul>
<?php } ?>
</div><!-- SUBNAV END -->
<div id="contentMainInterior"><!-- CONTENT MAIN START -->
<?php while (have_posts()) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; ?>
</div><!-- CONTENT MAIN END -->
<div class="clear"></div>
</div><!-- CONTENT END -->