• jimisdon

    (@jimisdon)


    I am wondering if there is a supported way to add some HTML markup to the descriptions of repeating fields via php. Something like this:

    simple_fields_register_field_group('project_properties',
      array (
        'name' => 'Project Properties',
        'description' => '<a href="http://maps.google.com" >Search</a> for locations to use below.',
        'repeatable' => 0,
        'fields' => array(
          array(
            'slug' => "project_location",
            'name' => 'Project Location',
            'description' => 'Example: "Topeka, KS"',
            'type' => 'text'
          )
        )
      )
    )

    As of now, the <a> is brought into the description as text and not as markup. Is there a supported way to change that?

    http://wordpress.org/extend/plugins/simple-fields/

Viewing 1 replies (of 1 total)
  • Thread Starter jimisdon

    (@jimisdon)

    It seems, looking at the code there is no supported way to get around this.

    The code in question is near line 1402 in the simple_fields.php file:

    // show description
    	if (!empty($current_field_group["description"])) {
    		printf("<p class='%s'>%s</p>", "simple-fields-meta-box-field-group-description", esc_html($current_field_group["description"]));
    	}

    I hate to modify the code of this plugin, which would break my whenever updates are available. I’d love to suggest adding the ability to use HTML in the description as an option. For me, that option would need to be allowed through PHP. I am sure there are a couple other description fields that use esc_html() as well. Not sure if they all need the option. I believe it makes the most sense here.

    I am guessing that in the meantime, I can creatively use the filter associated with esc_html() to get the results I want. I’ll post my solution if it works.

Viewing 1 replies (of 1 total)
  • The topic ‘Add HTML to descriptions?’ is closed to new replies.