0

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 ;)

0

esc_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

| improve this answer | |
  • Thank you, that worked nicely! It is probably true that using the standard Wordpress customizer functions is better than a framework, but I do not possess enough knowledge of PHP and Wordpress functions, to create more advanced controls, like a control for Google Fonts (kirki.org/docs/controls/typography). I'm working on it ;) – ralphsmit Dec 28 '19 at 18:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.