array(
1 => array(
name => test1,
parent_id => 0
),
2 => array(
name => test2,
parent_id => 1
),
3 => array(
name => test3,
parent_id => 1
),
)
array(
1 => array(
name => test1,
parent_id => 0,
childs => array(
2 => array(
name => test2,
parent_id => 1
),
3 => array(
name => test3,
parent_id => 1
),
)
)
)
array(
2 => array(
name => test2,
parent_id => 1
),
1 => array(
name => test1,
parent_id => 0
),
3 => array(
name => test3,
parent_id => 1
),
)
array(
1 => array(
name => test1,
parent_id => 0,
childs => array(
3 => array(
name => test3,
parent_id => 1
),
)
)
)
the_post_thumbnail( array( ххх, ххх, 'bfi_thumb' => true ) );
function my_styles() {
wp_enqueue_style( 'my-style', get_stylesheet_uri() . '/css/style.css');
}
add_action( 'wp_enqueue_scripts', 'my_styles' );
<?php $product->list_attributes(); ?>
используется метот list_attributes(); Можно на этом остановиться и в своем шаблоне написать global $product;
$product->list_attributes();
public function list_attributes() {
wc_get_template( 'single-product/product-attributes.php', array(
'product' => $this
) );
}
$attributes = $product->get_attributes();
.........
<?php foreach ( $attributes as $attribute ) :
if ( empty( $attribute['is_visible'] ) || ( $attribute['is_taxonomy'] && ! taxonomy_exists( $attribute['name'] ) ) ) {
continue;
} else {
$has_row = true;
}
?>
<tr class="<?php if ( ( $alt = $alt * -1 ) == 1 ) echo 'alt'; ?>">
<th><?php echo wc_attribute_label( $attribute['name'] ); ?></th>
<td><?php
if ( $attribute['is_taxonomy'] ) {
$values = wc_get_product_terms( $product->id, $attribute['name'], array( 'fields' => 'names' ) );
echo apply_filters( 'woocommerce_attribute', wpautop( wptexturize( implode( ', ', $values ) ) ), $attribute, $values );
} else {
// Convert pipes to commas and display values
$values = array_map( 'trim', explode( WC_DELIMITER, $attribute['value'] ) );
echo apply_filters( 'woocommerce_attribute', wpautop( wptexturize( implode( ', ', $values ) ) ), $attribute, $values );
}
?></td>
</tr>
<?php endforeach; ?>
<?php
/**
* woocommerce_single_product_summary hook.
*
* @hooked woocommerce_template_single_title - 5
* @hooked woocommerce_template_single_rating - 10
* @hooked woocommerce_template_single_price - 10
* @hooked woocommerce_template_single_excerpt - 20
* @hooked woocommerce_template_single_add_to_cart - 30
* @hooked woocommerce_template_single_meta - 40
* @hooked woocommerce_template_single_sharing - 50
*/
do_action( 'woocommerce_single_product_summary' );
?>
if ( ! function_exists( 'woocommerce_template_single_price' ) ) {
/**
* Output the product price.
*
* @subpackage Product
*/
function woocommerce_template_single_price() {
wc_get_template( 'single-product/price.php' );
}
}
This template can be overridden by copying it to yourtheme/woocommerce/single-product/price.php.
get_post_meta();
$product->get_price();
$product->is_on_sale();
и т.д. полный список методов здесь