打印变量内部功能' wp_editor'

发布于 2025-01-27 17:26:23 字数 447 浏览 3 评论 0原文

我试图用树枝定义WordPress Textarea的初始值。 因此,我使用此代码:

{% set job_text = "test text" %}
{{ fn('wp_editor', "{{ job_text }}", 'post_content', {'textarea_name':'post_content','media_buttons': 0, 'wpautop':true, 'editor_height':'200px', 'quicktags': 0} ) }}

但是,此代码将带有文本{{job_text}}而不是测试文本而打印文本方面。 我使用了不同的选项(例如job_text{job_text}),但它仍然打印出文本,而不是变量的值。

我在这里想念什么?

I am trying to define initial value for Wordpress textarea with twig.
So I use this code:

{% set job_text = "test text" %}
{{ fn('wp_editor', "{{ job_text }}", 'post_content', {'textarea_name':'post_content','media_buttons': 0, 'wpautop':true, 'editor_height':'200px', 'quicktags': 0} ) }}

But this code prints textarea with text {{ job_text }} instead of test text.
I used different options (like job_text or { job_text }) but it still prints text, not a variable's value.

What I miss here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浊酒尽余欢 2025-02-03 17:26:23

我发现一个问题。感谢@darkbee。
它在job_text part中是错误的语法。

正确的代码是:

{% set job_text = "test text" %}
{{ fn('wp_editor', job_text, 'post_content', {'textarea_name':'post_content','media_buttons': 0, 'wpautop':true, 'editor_height':'200px', 'quicktags': 0} ) }}

I found a problem. Thanks to @DarkBee.
It was incorrect syntax in job_text part.

Correct code is:

{% set job_text = "test text" %}
{{ fn('wp_editor', job_text, 'post_content', {'textarea_name':'post_content','media_buttons': 0, 'wpautop':true, 'editor_height':'200px', 'quicktags': 0} ) }}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文