Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'woocommerce_attribute', 'make_product_atts_linkable', 10, 3 );
- function make_product_atts_linkable( $text, $attribute, $values ) {
- $new_values = array();
- foreach ( $values as $value ) {
- if ( $attribute['is_taxonomy'] ) {
- $url = "http://link.com/" . $value;
- if ( ! empty( $url ) ) {
- $val = '<a href="' . esc_url( $url ) . '" title="' . esc_attr( $value ) . '">' . $value . '</a>';
- array_push( $new_values, $val );
- } else {
- array_push( $new_values, $value );
- }
- }
- }
- $text = implode( ', ', $new_values );
- return $text;
- }
Add Comment
Please, Sign In to add comment