使用WordPress 3.7.1我試圖在我創建的頁面上顯示所有的常規帖子,以免說TestPage。下面是我做這個步驟:不能通過循環抓住WordPress的內置帖子
生成自定義頁面模板稱爲:Test Page
,並通過加載下面的代碼
2-生成一個名爲TestPage頁面基於Test Page
模板
更新頁面後,我沒有得到任何郵政頁面,而我已經產生了一些!
<?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(); ?>
他abouve代碼實際上是加載不是由職位的TestPage和頁面絲毫標題和內容!你能請讓我知道爲什麼發生這種情況?