Thanks for the reply @jumar
I’ve got the product category under the title like so:
// Title
// -----
function x_woocommerce_template_loop_product_title() {
echo '<h3><a href="' . get_the_permalink() . '">' . get_the_title() . '</a></h3>';
$categories = get_the_terms( get_the_ID(), 'product_cat' );
foreach ($categories as $category)
echo '<div class="prod_cat_front"><h4> ' . $category->name . ' </h4></div>';
}
add_action( 'woocommerce_shop_loop_item_title', 'x_woocommerce_template_loop_product_title', 10 );
remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 );
I’m also inserting a secondary feature image, the primary one fades on a timer using javascript
// Shop Product Thumbnails
// -----------------------
function x_woocommerce_shop_product_thumbnails() {
GLOBAL $product;
$id = get_the_ID();
$thumb = 'shop_catalog';
$rating = ( function_exists( 'wc_get_rating_html' ) ) ? wc_get_rating_html( $product->get_average_rating() ) : $product->get_rating_html();
$feature2 = kdmfi_get_featured_image( 'featured-image-2');
woocommerce_show_product_sale_flash();
echo '<div class="entry-featured"';
if ( ! empty( $feature2 ) ) {
echo 'style="background-image: url(';
echo kdmfi_get_featured_image_src( 'featured-image-2', 'medium' );
echo ');">';
}
else
{
echo 'style="background-image: url(';
echo get_the_post_thumbnail_url( $id, $thumb );
echo ');">';
}
echo '<a href="' . get_the_permalink() . '">';
echo get_the_post_thumbnail( $id, $thumb );
if ( ! empty( $rating ) ) {
echo '<div class="star-rating-container aggregate">' . $rating . '</div>';
}
echo '</a>';
echo "</div>";
}
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
add_action( 'woocommerce_before_shop_loop_item_title', 'x_woocommerce_shop_product_thumbnails', 10 );
And I’ve a Gender tag in the top right corner that’s put together with css and the category names
// Shop Item Wrapper
// -----------------
function x_woocommerce_before_shop_loop_item() {
echo '<div class="entry-product">';
echo '<span class="prodcat';
$categories = get_the_terms( get_the_ID(), 'product_cat' );
foreach ($categories as $category)
echo ' ' . $category->name . '';
echo '" title=" ' . $category->name . ';';
echo '"> </span>';
}
function x_woocommerce_after_shop_loop_item() {
echo '</div>';
}
function x_woocommerce_before_shop_loop_item_title() {
echo '<div class="entry-wrap"><header class="entry-header">';
}
function x_woocommerce_after_shop_loop_item_title() {
woocommerce_template_loop_add_to_cart();
echo '</header></div>';
}
add_action( 'woocommerce_before_shop_loop_item', 'x_woocommerce_before_shop_loop_item', 10 );
add_action( 'woocommerce_after_shop_loop_item', 'x_woocommerce_after_shop_loop_item', 10 );
add_action( 'woocommerce_before_shop_loop_item_title', 'x_woocommerce_before_shop_loop_item_title', 10 );
add_action( 'woocommerce_after_shop_loop_item_title', 'x_woocommerce_after_shop_loop_item_title', 10 );
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 );
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
How do I go about replacing these via functions.php?