Wordpress 编辑器块在我的主题中不起作用

问题描述 投票:0回答:1

我创建了自己的主题并添加了自定义帖子类型。

在帖子创建过程中,我使用默认的块编辑器,并添加段落、标题等。

问题是发布帖子后没有应用样式。

当我切换到主题二十二三时,我在 html 代码中看到

<div class="entry-content wp-block-post-content has-global-padding is-layout-constrained wp-block-post-content-is-layout-constrained">

围绕我的整个帖子内容,例如

<h3 class="wp-block-heading has-text-align-center">Header 1</h3>

对于我主题中的同一篇文章,不会生成此 div。

标题 1 看起来像这样:

<h3>Header 1</h3>

我应该怎样做才能使其正常工作?

我在配置中遗漏了什么吗?

css wordpress wordpress-gutenberg
1个回答
0
投票

您的主题需要在您的

<head>
部分中的某个位置包含此函数调用:

<?php wp_head();?>

同样,您需要在关闭

<body>
部分之前包含此函数调用:

<?php wp_footer(); ?>

如果没有这些声明,您的主题将无法与 WordPress 正确集成。

© www.soinside.com 2019 - 2024. All rights reserved.