WordPress.org

Support

Support » Plugins and Hacks » Formatting product attribute text

Formatting product attribute text

  • eMojster
    Member

    @emojster

    Hi all!

    I’ve been wondering if there is any way to format display of the attribute text? HTML markup is ignored and stripped after reloading/saving the backend product page.

    Example:

    Attribute: color
    Value: red | green | blue
    Output on frontpage: red, green, blue

    I want the color attributes to be displayed as a unordered list – each parameter in its own line.

    I’ve found only some PHP code to append to the functions.php file, that should remove the filter … but they are not working for me. It is used to enable HTML in category & tag descriptions – some reported it is working also with atributes, but not for me.

    remove_filter( 'pre_term_description', 'wp_filter_kses' );
    remove_filter( 'term_description', 'wp_kses_data' );

    and

    $filters = array('pre_term_description', 'pre_link_description', 'pre_link_notes', 'pre_user_description');
    foreach ( $filters as $filter ) {
    	remove_filter($filter, 'wp_filter_kses');
    }
    
    foreach ( array( 'term_description' ) as $filter ) {
    	remove_filter( $filter, 'wp_kses_data' );
    }

    Any ideas how to at least change the “, ” (comma+space) seperator formatting to a line-break (<br />)?

  • The topic ‘Formatting product attribute text’ is closed to new replies.