【问题标题】:WordPress showing title but not content of pagesWordPress显示标题但不显示页面内容
【发布时间】:2018-09-15 07:32:22
【问题描述】:

我在 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 中添加什么以使一切顺利?

【问题讨论】:

    标签: php wordpress


    【解决方案1】:

    你缺少的是标准的 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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-11-17
      • 1970-01-01
      • 2020-07-15
      • 2011-07-24
      • 2016-03-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多