Make product attributes link through to archives
Issue #12518. In the "Additional information" tab, link public attributes to their archive pages
This commit is contained in:
parent
ac3d847a16
commit
cc5452cfe3
|
@ -41,7 +41,25 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<tr>
|
||||
<th><?php echo wc_attribute_label( $attribute->get_name() ); ?></th>
|
||||
<td><?php
|
||||
$values = $attribute->is_taxonomy() ? wc_get_product_terms( $product->get_id(), $attribute->get_name(), array( 'fields' => 'names' ) ) : $attribute->get_options();
|
||||
$values = array();
|
||||
|
||||
if ( $attribute->is_taxonomy() ) :
|
||||
|
||||
$attribute_taxonomy = $attribute->get_taxonomy_object();
|
||||
$attribute_values = wc_get_product_terms( $product->get_id(), $attribute->get_name(), array( 'fields' => 'all' ) );
|
||||
|
||||
foreach ( $attribute_values as $attribute_value ) :
|
||||
if ( $attribute_taxonomy->attribute_public ) :
|
||||
$values[] = '<a href="'. esc_url( get_term_link( $attribute_value->term_id, $attribute->get_name() ) ) . '" rel="tag">' . $attribute_value->name . '</a>';
|
||||
else:
|
||||
$values[] = $attribute_value->name;
|
||||
endif;
|
||||
endforeach;
|
||||
|
||||
else :
|
||||
$values = $attribute->get_options();
|
||||
endif;
|
||||
|
||||
echo apply_filters( 'woocommerce_attribute', wpautop( wptexturize( implode( ', ', $values ) ) ), $attribute, $values );
|
||||
?></td>
|
||||
</tr>
|
||||
|
|
Loading…
Reference in New Issue