Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding HTML to Description text? #976

Closed
regan008 opened this issue May 16, 2016 · 2 comments
Closed

Adding HTML to Description text? #976

regan008 opened this issue May 16, 2016 · 2 comments

Comments

@regan008
Copy link

regan008 commented May 16, 2016

Issue description:

Hi, I had one quick question for you. I've googled a bit and can't seem to find out if this is possible or not but I was wondering if its possible to add html to a section's description? The code is below but what I'm trying to do is add a link to the documentation in the description at the top of the section. Am I missing something simple or is this not advised/possible? Thanks so much!

Version used:

(Did you try using the develop branch from github? There's a chance your issue has already been adressed there) Current Develop version.

Using theme_mods or options?

options

Code to reproduce the issue (config + field(s))

Kirki::add_section( 'Block2', array(
    'title'          => __( 'Block 2 Options', 'pressforward_tk_theme' ),
    'description'    => __( 'The second block on the homepage is made up of four “columns”. Each column includes a title which can (optionally) link to a page or post within the site. Above each title a icon from the <a href="www.fontawesome.io">FontAwesome</a> icon set can be displayed. If you wish include an icon above the title, enter the css class name of the FontAwesome icon in the box(s) below', 'pressforward_tk_theme' ),
    'panel'          => 'homepage', // Not typically needed.
    'priority'       => 160,
    'capability'     => 'edit_theme_options',
    'theme_supports' => '', // Rarely needed.
) );
@rahulv3a
Copy link

rahulv3a commented May 24, 2016

If you put custom field as the first field of the section, it could act as section description. HTML is allowed in custom field.

Kirki::add_field( 'my_config', array(
  'settings' => 'my_setting',
  'section'  => 'my_section',
  'type'     => 'custom',
  'default'  => __( '<a target="_blank" href="#">HTML content goes here</a>', 'kirki' ),
) );

I would recommend passing dafault through wp_kses so that translators don't mess up your theme.

Kirki::add_field( 'my_config', array(
  'settings' => 'my_setting',
  'section'  => 'my_section',
  'type'     => 'custom',
  'default'  => wp_kses( __( '<a target="_blank" href="#">HTML content goes here</a>', 'kirki' ), array(
    'a' => array(
      'target' => array(),
      'href' => array(),
    ),
  ) ),
) );

@aristath
Copy link
Contributor

fixed in the latest develop branch. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants