Replace new lines with empty strings when outputting catgeory list (https://github.com/woocommerce/woocommerce-blocks/pull/4587)
* Replace new lines with empty strings when outputting catgeory list This is because br tags are being added because of linebreaks in the string. If we replace the linebreaks with empty strings they won't be converted into br elements. * Add parentheses around product count * Remove spaces from around title * Remove parentheses from product count
This commit is contained in:
parent
48cf656269
commit
b403872300
|
@ -304,16 +304,14 @@ class ProductCategories extends AbstractDynamicBlock {
|
|||
foreach ( $categories as $category ) {
|
||||
$output .= '
|
||||
<li class="wc-block-product-categories-list-item">
|
||||
<a href="' . esc_attr( get_term_link( $category->term_id, 'product_cat' ) ) . '">
|
||||
' . $this->get_image_html( $category, $attributes ) . esc_html( $category->name ) . '
|
||||
</a>
|
||||
<a href="' . esc_attr( get_term_link( $category->term_id, 'product_cat' ) ) . '">' . $this->get_image_html( $category, $attributes ) . esc_html( $category->name ) . '</a>
|
||||
' . $this->getCount( $category, $attributes ) . '
|
||||
' . ( ! empty( $category->children ) ? $this->renderList( $category->children, $attributes, $uid, $depth + 1 ) : '' ) . '
|
||||
</li>
|
||||
';
|
||||
}
|
||||
|
||||
return $output;
|
||||
return preg_replace( '/\r|\n/', '', $output );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue