【发布时间】:2013-11-03 09:51:58
【问题描述】:
使用 WordPress 3.7.1 我试图在我创建的页面上显示所有常规帖子,以免说 TestPage。以下是我为此采取的步骤:
1- 生成一个名为:Test Page 的自定义页面模板并通过以下代码加载
2- 根据Test Page 模板生成一个名为 TestPage 的页面
更新页面后,我没有在页面上收到任何帖子,而我已经生成了一些帖子!
<?php
/*
Template Name: Test Page
*/
?>
<?php get_header(); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h1><?php the_title() ;?></h1>
<?php the_content(); ?>
<?php endwhile; else: ?>
<p>Sorry, this page does not exist</p>
<?php endif; ?>
<?php get_footer(); ?>
他上面的代码实际上是加载页面的标题和 TestPage 的内容,而不是通过帖子!你能告诉我为什么会这样吗?
【问题讨论】:
标签: wordpress wordpress-theming