我在索引中添加了以下代码。php,它工作得很好。然后我将其添加到我的类型-[post\\u type]。php文件,它仍然显示页面上最后一篇文章的代码。我不明白为什么。我应该换一种方式吗?
<?php if( $wp_query->current_post < $wp_query->post_count-1 ): ?>
<img src="<?php bloginfo(\'template_directory\'); ?>/images/fezhr.png" />
<?php endif; ?>
以下是我对其中一种帖子类型的循环:
<?php if (have_posts()) : ?>
<div id="content">
<div id="latestLinks">
<div id="listHead">Latest</div>
<div id="listLinks"><a href="http://www.flesheatingzipper.com/" id="linksA">EVERYTHING</a> | <a href="http://www.flesheatingzipper.com/games/" id="linksG">GAMES</a> | <a href="http://www.flesheatingzipper.com/entertainment/" id="linksE">ENTERTAINMENT</a> | <a href="http://www.flesheatingzipper.com/tech/" id="linksT">TECH</a> | <a href="http://www.flesheatingzipper.com/podcasts/" id="linksP">PODCASTS</a></div>
<br style="clear:both;" />
</div>
<?php while (have_posts()) : the_post(); ?>
<div class="postWrapper">
<h1><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
<div class="postDetails">
<div class="postDetailsLeft">Posted by: <?php the_author_posts_link(); ?> on <?php the_time(\'F j, Y\'); ?> at <?php the_time(\'g:i a\'); ?></div>
<div class="postDetailsRight"><?php if(function_exists(\'the_views\')) { the_views(); } ?> | <a href="<?php comments_link(); ?>"><?php comments_number(\'0 Comments\', \'1 Comment\', \'% Comments\'); ?></a></div>
<br style="clear:both;" />
</div>
<?php
if ( has_post_thumbnail() ) {
$image_id = get_post_thumbnail_id();
$image_url = wp_get_attachment_image_src($image_id, \'large\', true);
echo \'<a href="\' . get_permalink($post->ID) . \'" title="\' . get_the_title($post->ID) . \'"><img src="\' . $image_url[0] . \'" title="\' . get_the_title($post->ID) . \'" alt="\' . get_the_title($post->ID) . \'" class="aligncenter" /></a>\';
}
?>
<?php
ob_start();
the_content(\'Read the rest of this article...\');
$postOutput = preg_replace(\'/<img[^>]+./\',\'\', ob_get_contents());
ob_end_clean();
echo $postOutput;
?>
<br style="clear:both;" />
</div>
<?php if( $wp_query->current_post < $wp_query->post_count-1 ): ?>
<img src="<?php bloginfo(\'template_directory\'); ?>/images/fezhr.png" class="fezHR" />
<?php endif; ?>
<?php endwhile; ?>
<?php wp_pagenavi(); ?>
<?php else : ?>
<div id="content">
<img src="<?php bloginfo(\'template_directory\'); ?>/images/FEZ404.png" /><br /><br />
<p>God dammit! FEZ why do you always ruin all the fun. Sorry the page you requested has been eaten! You will just have to find something else, deal with it.</p>
<?php endif; ?>