2011-01-10 72 views
2

我有一個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 --> 

回答

9

您應該添加「循環」中你的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; ?> 

希望幫助!祝你好運。

+0

但不會「循環」列出我所有的帖子,而不是應該在那裏的一個特定的一個? – Skizit 2011-01-10 12:41:15

相關問題