I'm building a Wordpress theme and I use the Kirki Customizer framework to add controls and settings to the customiser. I added a description to some controls, using the following code:
'description' => esc_html__( 'Description here', 'kirki' ),
Now I want to add a link in the description to an external website. I already tried inserting HTML, but that doesn't work; it just did just output the flat HTML code. It probably has sth to do with the esc_html__() thing, but I already searched on the internet and couldn't find a solution for this. Please enlighten me if you have a solution! Thanks a lot ;)
I'm building a Wordpress theme and I use the Kirki Customizer framework to add controls and settings to the customiser. I added a description to some controls, using the following code:
'description' => esc_html__( 'Description here', 'kirki' ),
Now I want to add a link in the description to an external website. I already tried inserting HTML, but that doesn't work; it just did just output the flat HTML code. It probably has sth to do with the esc_html__() thing, but I already searched on the internet and couldn't find a solution for this. Please enlighten me if you have a solution! Thanks a lot ;)
Share Improve this question asked Dec 27, 2019 at 11:37 ralphjsmitralphjsmit 4026 silver badges23 bronze badges1 Answer
Reset to default 0esc_html__
is a translation API, specifically it's equivalent to this:
$var = esc_html( __( ... ) );
Note that __(
is not a language construct, it's a WordPress function.
Your problem is that esc_html
escapes your HTML so that its safe to render as text. Swap it for wp_kses_post
, and remove the __
function, you don't want html inside translation strings
A sidenote: Frameworks are useful, but they have disadvantages, in order to get help you now need to have the luck of coming across somebody else already familiar with the kirki customizer framework, which I've never heard of. General customizer knowledge is of little to no help, severely limiting your ability to research solutions and get the help of others.
In this case, your question was answerable without knowing anything about the customizer
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744877473a4598634.html
评论列表(0条)