php - WordPress 显示标题但不显示页面内容

标签 php wordpress

我在 page.php 下有常规 WordPress 页面的 ff: 代码:

<section id="content-wrapper">
    <div class="sqs-cart-dropzone"></div>
    <div class="content">
        <div class="content-inner" data-content-field="main-content">
        <div class="sqs-layout sqs-grid-12 columns-12" data-type="page" data-updated-on="1456865486035" id="page-54821cc9e4b0ab9977bd33f7">
        <?php the_title( sprintf( '<h1><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h1>' ); ?>
        <?php the_content(); ?>
    </div>
</section>

由于某种原因,这不会提取页面的内容。它只显示页面标题,但根本不显示任何内容。

我错过了什么?

我应该在 page.php 上添加什么才能让一切顺利进行?

最佳答案

您缺少的是标准 WordPress 循环

<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
      <?php the_title( sprintf( '<h1><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h1>' ); ?>
      <?php the_content(); ?>
<?php endwhile; endif; ?>

Check

关于php - WordPress 显示标题但不显示页面内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41009034/

相关文章:

php - Zend framework file upload 非法上传

php - 对于 (PHP 5 < 5.5.0),password_hash() 的替代方法是什么?

css - 将带有链接的图像居中

WordPress 不必要的重定向。如何解决问题

wordpress - 上传文件wordpress

mysql - SQLite 上的 WordPress 元查询不起作用

javascript - UTF8 字符无法正确显示数据表和 yadcf

php - 更新 MySql 字段(如果字段不为空,转到下一个)

php - 如何在 PHP 中通过正则表达式提取圣经书名、章节和经文编号?

mysql - 我可以在一个 MySQL 数据库中使用 2 个 WordPress 数据库吗