page.php 没有显示内容
page.php not showing content
我开始开发我的第一个 WordPress 主题,但遇到 page.php
未在新创建的页面上显示内容的问题。
这是我的 index.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();
?>
这根本不是问题...我认为我从面板创建的每个页面都需要包含帖子的内容:) 仅此而已。抱歉给您带来不便
我开始开发我的第一个 WordPress 主题,但遇到 page.php
未在新创建的页面上显示内容的问题。
这是我的 index.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();
?>
这根本不是问题...我认为我从面板创建的每个页面都需要包含帖子的内容:) 仅此而已。抱歉给您带来不便