0
我開始開發我的第一個WordPress主題,我在page.php
上遇到問題,沒有在新創建的頁面上顯示內容。 這是我的代碼index.php
和page.php
。page.php沒有顯示內容
的index.php:
<?php
get_header();
if(have_posts()):
while(have_posts()): the_post(); ?>
<article class='post'>
<h2><a href="<?php the_permalink();?>"><?php the_title();?></a></h2>
<?php the_content()?>
</article>
<?php endwhile;
else:
echo '<p>No content found</p>';
endif;
get_footer();
?>
和page.php文件:
<?php
get_header();
if(have_posts()):
while(have_posts()): the_post(); ?>
<article class='post page'>
<h2><?php the_title();?></h2>
<?php the_content()?>
</article>
<?php endwhile;
else:
echo '<p>No content found</p>';
endif;
get_footer();
?>
你試過'echo $ post-> post_content;'而不是'the_content()'嗎? – 2015-02-23 17:39:11
這個dosn't做一個改變,仍然沒有內容displayd – 2015-02-23 17:48:47
「page.php沒有顯示新創建的頁面上的內容」,你的意思是index.php嗎?也index.php與page.php無關,它與single.php有關,順便說一句,你的模板對我來說很好。 – Stickers 2015-02-23 18:02:46