2016-12-06 50 views
0

頁面模板命名頁面person.php從模板創建的與身定製

<?php 
/** 
* Template Name: Person Page 
* The template for displaying all pages. 
* 
* This is the template that displays all pages by default. 
* Please note that this is the WordPress construct of pages 
* and that other 'pages' on your WordPress site may use a 
* different template. 
* 
* @link https://codex.wordpress.org/Template_Hierarchy 
* 
* @package mentorme 
*/ 

get_header(); ?> 
     <div class="personality"> 
      <!-- dynamic content --> 
      <?php the_content(); ?> 
     </div> 
    <?php get_footer(); ?> 

現在我已經加入了一些測試內容創建網頁,同時創造從模板「個人頁面」的頁面這樣 enter image description here

但在頁面上/ dr-xyz它沒有在任何地方顯示文本'測試'!

回答

1

你可以使用the_content顯示的內容和the_title()顯示您的文章標題。試試下面的代碼

<?php get_header(); ?> 
<div class="personality"> 
    <?php if (have_posts()) : 
     while (have_posts()) : the_post(); ?> 
      <?php the_title(); ?> 
      <?php the_content(); ?> 
     <?php endwhile; ?> 
    <?php endif; ?> 
</div> 
<?php get_footer(); ?> 
+0

它仍然沒有顯示內容! – coure2011

+0

閱讀更多是更多的鏈接文本參數,它接受用作readmore文本的文本字符串。 –

+0

你能更具體嗎?你得到什麼樣的輸出?您是否獲得了完整的空白屏幕,或者您只獲取頁眉和頁腳? –

0

試試這個

if (have_posts()) { 
    while (have_posts()) { 
    the_post(); 
    the_content(); 
    } // end while 
} // end if