(woocommerce Version 2.4.6 - wordpress Version 4.2.2)
I want show on my homepage 3 product category (image, title, link + description : for each cat)
I try this
<?php
// Déterminer des informations des catégories des produits
$args = array(
'number' => $number,
'orderby' => 'slug',
'order' => 'ASC',
'hide_empty' => $hide_empty,
'include' => $ids
);
$product_categories = get_terms( 'product_cat', $args );
// Déterminer le nombre de catégories
$count = count($product_categories);
if ( $count > 0 ){ // S'il y a au moins une catégorie
foreach ( $product_categories as $product_category ) {
// Déterminer l'identifiant de la vignette d'une catégorie
$thumbnail_id = get_woocommerce_term_meta( $product_category->term_id, 'thumbnail_id', true );
// Extraire l'URL de la vignette
$thumbnail_url = wp_get_attachment_thumb_url( $thumbnail_id );
// Aficher la vignette et le nom de la catégorie comme un lien vers la page de la catégorie
echo '<h2><img src="'.$thumbnail_url.'" /><a href="' . get_term_link( $product_category ) . '"> ' . $product_category->name . '</a></h2>';
}
}
?>
.. but it lacks the description and I would show only for category 3 in particular (eg id 90, 91, 92)
maybe With shortcode ?
Thank