'Print variable inside function 'wp_editor'
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?
Solution 1:[1]
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} ) }}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Kir Mazur |
