2010-06-28 76 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

相关问题