WordPress的单个帖子内容没有显示
问题描述:
我有一个wordpress博客主题,它显示了索引上所有帖子的内容,但是当我点击其中一个帖子时,帖子的内容是空白的,我不能似乎找出原因。如果我没有错,single.php
控制该页面。WordPress的单个帖子内容没有显示
http://pastebin.com/afLVxMPb =我的single.php
我的意思是http://www.ndesign-studio.com/demo/wordpress/blog/how-about-a-blog-post-with-longer-title但在这个网站上的博客文章的内容没有出现,但在我的它没有一个例子。
我认为这个问题是这里的某个地方......
<div class="entry-content">
<?php the_content(); ?>
<?php wp_link_pages('before=<div class="page-link">' . __('Pages:', 'your-theme') . '&after=</div>') ?>
</div><!-- .entry-content -->
答
您应该添加“循环”中你的single.php文件的地方,并调用setup_postdata($ POST)或the_post(),这样你可以访问该循环内的发布数据。
了解更多关于循环这里:http://codex.wordpress.org/The_Loop
例如,您的single.php文件看起来像这样(简化):
........
<div id="content">
<?php if(have_posts()) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h1 class="entry-title"><?php the_title(); ?></h1>
// etc.. all post info
............
<?php endforeach; ?>
希望帮助!祝你好运。
但不会“循环”列出我所有的帖子,而不是应该在那里的一个特定的一个? – Skizit 2011-01-10 12:41:15