page.php 的内容在 wordpress 中不显示 [英] contents of page.php does not show in wordpress

查看:27
本文介绍了page.php 的内容在 wordpress 中不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在本地主机上更新了我的网站并上传到服务器 (000Webhost) 然后 page.php 的内容(所有其他模板)不再显示.但是它在本地主机上仍然可以正常工作.我认为服务器上的 Wordpress 出了问题,所以我删除了数据库并重新创建它们,还重新安装了 Wordpress,然后上传了我的主题,但仍然无法正常工作.有谁知道发生了什么以及我在做什么?我的page.php很简单,如下图,呵呵,有标题,没内容.

<div id="内容"><h1 class="entry-title"><?php the_title();?></h1><p><?php the_content();?></p><div style="clear:both;"></div>

<?php get_footer();?>

这里是网站.

http://ahi.webatu.com/?page_id=12

在此先非常感谢您!!

解决方案

您需要在 the_post() 范围内才能根据需要使用 the_content() 函数

<?php if( have_posts() ) : the_post();?><?php the_content();?><?php endif;?>

I have updated my site on localhost and uploaded to server (000Webhost) then the contents of page.php(all other template as well) does not show anymore. However it still work fine on localhost. I thought something gone wrong in Wordpress on server so I have deleted database and recreate them and also reinstall Wordpress and then uploaded my theme but still not working. Does anyone know what is happening and what I am doing worng?? My page.php is very simple like this below, Oh the title is showing but not the contents.

<?php get_header(); ?>
<div id="content">
<h1 class="entry-title"><?php the_title(); ?></h1> 
<p>
 <?php the_content(); ?>
</p>
  <div style="clear:both;"></div>
</div>

<?php get_footer(); ?>

here is the site.

http://ahi.webatu.com/?page_id=12

Thank you very much in advance!!

解决方案

You need to be in the_post() scope to use the_content() function as you want

<?php if( have_posts() ) : the_post(); ?>

<?php the_content(); ?>

<?php endif; ?>

这篇关于page.php 的内容在 wordpress 中不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆