Php 如何在wordpress中显示前端站点的页面内容区域
我是wordpress的新手,我正在尝试创建一个网站。我需要显示页面的内容时,相应的菜单项被单击。mypage.php包含Php 如何在wordpress中显示前端站点的页面内容区域,php,wordpress,Php,Wordpress,我是wordpress的新手,我正在尝试创建一个网站。我需要显示页面的内容时,相应的菜单项被单击。mypage.php包含 <?php while ( have_posts() ) : the_post(); $page_data= $post->ID; if($page_data=='116') //Home page { ?>
<?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
}
参考链接-您是否已在管理端内容区域添加了内容?