Answer the question
In order to leave comments, you need to log in
Wordoress wodocommerce can't figure out where to connect the display of attributes in the header?
Good afternoon, Seoshnik turned to the site.
The bottom line is that he received duplicate titles during import, and wants to spice it up with a crutch (add a brand to the title).
I'm in WordPress not boom boom.
In general, I found from where you can pull the brand:
defined( 'ABSPATH' ) || exit;
if ( ! $product_attributes ) {
return;
}
?>
<?php foreach ( $product_attributes as $product_attribute_key => $product_attribute ) : ?>
<tr class="woocommerce-product-attributes-item woocommerce-product-attributes-item--<?php echo esc_attr( $product_attribute_key ); ?>">
<th class="woocommerce-product-attributes-item__label"><?php echo wp_kses_post( $product_attribute['label'] ); ?></th>
<td class="woocommerce-product-attributes-item__value"><?php echo wp_kses_post( $product_attribute['value'] ); ?> <?php if(wp_kses_post( $product_attribute['label'] )==='Артикул'){echo 'good';}?></td>
</tr>
<?php endforeach; ?>
Answer the question
In order to leave comments, you need to log in
Good afternoon.
Specifically, this code cannot be "pulled" into the header, since this is a woocommerce template file from the /plugins/woocommerce/templates/single-product/ directory, the file is product-attributes.php.
That is, this file is displayed on the product page. It cannot be taken anywhere else.
The brand in the title can be pulled out of the global $product global variable. For example -
global $product;
$brand = $product->get_name();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question