2015-02-23 116 views
0

我開始開發我的第一個WordPress主題,我在page.php上遇到問題,沒有在新創建的頁面上顯示內容。 這是我的代碼index.phppage.phppage.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(); 
?> 
+0

你試過'echo $ post-> post_content;'而不是'the_content()'嗎? – 2015-02-23 17:39:11

+0

這個dosn't做一個改變,仍然沒有內容displayd – 2015-02-23 17:48:47

+0

「page.php沒有顯示新創建的頁面上的內容」,你的意思是index.php嗎?也index.php與page.php無關,它與single.php有關,順便說一句,你的模板對我來說很好。 – Stickers 2015-02-23 18:02:46

回答

0

它was't在所有的問題...我想每一頁我從潘內爾需要創建從帖子中獲得內容:)就是這些。對不起,不好意思