[英]how to show page content area in the front site in wordpress
i'm new to wordpress and i'm trying to create a website. 我是wordpress的新手,正在尝试创建一个网站。 i need display the content of the pages when corresponding menu items are clicked.
单击相应的菜单项时,我需要显示页面的内容。 my page.php contain
我的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; ?>
but my content is not displaying. 但我的内容没有显示。 title is showing properly.
标题显示正确。 what is the mistake in the code?
代码中的错误是什么? please help me.
请帮我。
Try this - 尝试这个 -
global $post; // if outside the loop
if ( is_home() || is_front_page() ) {
//your code here
} else {
// This is not the home page
}
Reference link - http://codex.wordpress.org/Conditional_Tags 参考链接-http://codex.wordpress.org/Conditional_Tags
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.