在页面模板 PHP 文件中显示古腾堡内容
Display Gutenberg content in page template PHP file
我第一次尝试使用 WordPress 和新编辑器 Gutenberg 创建页面。在 Wordpress 中我总是使用:
<?php the_content(); ?>
显示内容,但不适用于 Gutenberg。当我在 PHP 页面模板文件中使用 Gutenberg 时,是否有一些新的方式来显示内容?
您必须在 WordPress while
循环中调用 the_content();
,如下所示。
if ( have_posts() ) {
while ( have_posts() ) : the_post();
the_content();
endwhile;
}
我第一次尝试使用 WordPress 和新编辑器 Gutenberg 创建页面。在 Wordpress 中我总是使用:
<?php the_content(); ?>
显示内容,但不适用于 Gutenberg。当我在 PHP 页面模板文件中使用 Gutenberg 时,是否有一些新的方式来显示内容?
您必须在 WordPress while
循环中调用 the_content();
,如下所示。
if ( have_posts() ) {
while ( have_posts() ) : the_post();
the_content();
endwhile;
}