2010-06-28 89 views
0

任何人都知道爲什麼the_content()不會顯示在我的single.php頁面上,而它顯示在index.php上?WordPress和the_content()

<div class="block"> 
    <h1><?php the_title(); ?></h1> 
    <p class="date"> 
     <?php the_date('d F Y'); ?> 
    </p> 
    <p> 
     <?php the_content(); ?> 
    </p> 
</div> 
+1

請顯示一些代碼。 – 2010-06-28 10:56:40

+0

您可能需要使用pastebin.com在某處上傳single.php和index.php中的代碼。所以我們可以看到出現了什麼問題...... – ariefbayu 2010-06-28 10:57:08

+1

是顯示的標題和日期是否正確?是否在while循環內 – RobertPitt 2010-06-28 10:58:25

回答

1

在你的single.php頁面nad索引頁面the_*()函數只能在循環中使用。

while(have_posts()) 
{ 
    ///the_content(); the_title(); the_post(); etc 
} 

//If I Used here then it would not work! 
+0

爲什麼the_title和the_date出現呢? – Alex 2010-06-28 10:58:27

+0

嘗試將the_content更改爲the_post() – RobertPitt 2010-06-28 10:58:53

+0

如果沒有循環來調用它們,標題和日期顯示的方式如何? – theorise 2010-06-28 11:53:13

相關問題