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