Home Forums WoodMart support forum html code not recognize in Promo Banner in HTML BLOCK

html code not recognize in Promo Banner in HTML BLOCK

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #92341

    khongyp
    Participant

    Hi,

    I found that we can’t use html code in Promo Banner in HTML BLOCK.

    For example:

    I have this text in the Promo Banner Content.

    <p>desktop publishing software like Aldus PageMaker including versions</p>
    
    <p>to make a type specimen book</p>
    
    <p>typesetting, remaining essentially unchanged</p>

    But when display on frontend it will becomes like this.

    desktop publishing software like Aldus PageMaker including versions to make a type specimen book typesetting, remaining essentially unchanged

    The <p> tags are removed. I have tried <br> tag too and it is also striped off. I found this problem happens only on HTML BLOCK, it is working fine in Pages.

    #92342

    khongyp
    Participant

    Here’s login details

    #92369

    Artem Temos
    Keymaster

    Hi,

    Yes, it is a problem with content added with HTML Blocks that we are not able to fix in our theme’s core. Try to add the following PHP code snippet to the child theme functions.php file to do this

    	function woodmart_get_html_block($id) {
    		$post = get_post( $id );
    		if ( ! $post || $post->post_type != 'cms_block' ) return;
    		$content = do_shortcode( wpautop( $post->post_content ) );
    
    		$shortcodes_custom_css = get_post_meta( $id, '_wpb_shortcodes_custom_css', true );
    		$woodmart_shortcodes_custom_css = get_post_meta( $id, 'woodmart_shortcodes_custom_css', true );
    		
    		$content .= '<style type="text/css" data-type="vc_shortcodes-custom-css">';
    		if ( ! empty( $shortcodes_custom_css ) ) {
    			$content .= $shortcodes_custom_css;
    		}
    
    		if ( ! empty( $woodmart_shortcodes_custom_css ) ) {
    			$content .= $woodmart_shortcodes_custom_css;
    		}
    		$content .= '</style>';
    
    		return $content;
    	}

    Regards

    #92458

    khongyp
    Participant

    It works. Thanks!

    #92510

    Artem Temos
    Keymaster

    You are welcome.

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘html code not recognize in Promo Banner in HTML BLOCK’ is closed to new replies.