簡體   English   中英

如何在wordpress的前站點中顯示頁面內容區域

[英]how to show page content area in the front site in wordpress

我是wordpress的新手,正在嘗試創建一個網站。 單擊相應的菜單項時,我需要顯示頁面的內容。 我的page.php包含

<?php while ( have_posts() ) : the_post(); 
                  $page_data= $post->ID;
                  if($page_data=='116') //Home page
                  {
                  ?>    

                  <center><b><h2>WELCOME TO THE CLINIC!!</h2></b></center>
                 <?php 

                  }
                 else{    //for other pages

                 ?>

                  <h1 class="entry-title"><?php the_title(); ?></h1>
                  <?php
                the_content();

                 }
                  endwhile; ?>

但我的內容沒有顯示。 標題顯示正確。 代碼中的錯誤是什么? 請幫我。

嘗試這個 -

global $post;     // if outside the loop

if ( is_home() || is_front_page() ) {

    //your code here

} else {

    // This is not the home page
}

參考鏈接-http://codex.wordpress.org/Conditional_Tags

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM