【发布时间】:2021-03-15 18:08:48
【问题描述】:
简而言之:我使用 Classic Editor 插件创建了一些自定义帖子类型,现在我必须将它们转换为 Gutenberg,但它总是搞砸我的 URL。
CPT 基本上是滑块内的幻灯片,每个都包含一个 YouTube URL 作为帖子内容(或 the_content),它被打印为带有 echo get_the_content 的播放图标元素的 href 属性,它工作正常 - echo get_the_content 的输出是这样的:
https://youtu.be/BFxGJM_sFUg.
但是,在将 CPT 转换为 Gutenberg 块后,get_the_content 的输出为:
<figure class="wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
https://youtu.be/BFxGJM_sFUg
</div></figure>
<!-- /wp:core-embed/youtube -->
由于额外的 HTML,这完全弄乱了布局,所以我的问题是 - 有没有办法阻止 Gutenberg 添加它?我花了几个小时在谷歌上搜索它,找到了一些在正确轨道上的解决方案(尽管它们涵盖的问题不一样),但没有一个对我有用。 :/
谢谢!
【问题讨论】:
-
如果您找到自己问题的答案,post an answer - 我们也鼓励您这样做。不要编辑问题 - 这个问题仍然只是一个问题。
标签: php wordpress wordpress-gutenberg gutenberg-blocks