BHWD
BHWD

Reputation: 123

HTML not rendering in php array esc_html

I am using the wordpress theme from elegantthemes called Divi

They have a full width slider with a button over the top. When you enter the text into the form feild that populates the button you can enter html but when it renders on the page you can see the html rather than see the output.

I have looked into the functions.php and have found the code block for the button which I have placed below. I think it is to do with the esc_html tag but don't have much experience with this?

add_shortcode( 'et_pb_slide', 'et_pb_slide' );
function et_pb_slide( $atts, $content = '' ) {
    extract( shortcode_atts( array(
            'alignment' => 'center',
            'heading' => '',
        'button_text' => '',
        'button_link' => '#',
        'background_color' => '',
        'background_image' => '',
        'image' => '',
        'image_alt' => '',
        'background_layout' => 'dark',
        'video_bg_webm' => '',
        'video_bg_mp4' => '',
        'video_bg_width' => '',
        'video_bg_height' => '',
        'video_url' => '',
    ), $atts
) );

This is the code directly for the button.

$button = '';
if ( '' !== $button_text )
    $button = sprintf( '<a href="%1$s" class="et_pb_more_button">%2$s</a>',
        esc_attr( $button_link ),
        esc_html( $button_text )
    );

Sorry I am unable to provide the URL at present.

Upvotes: 0

Views: 984

Answers (1)

BHWD
BHWD

Reputation: 123

I removed the esc_html and it worked.

Upvotes: 1

Related Questions