Jump to content

Wordpress Woocommerce Advice


Adam231184

Recommended Posts

Hi Everyone


I'm working with the woo commerece plugin and i'd like to have a sub heading under the title of each product.


Style and format is sorted however i want a particular Category to show in the sub heading section. I've managed to get as far as showing all categories but i want to narrow this down to just one category that is under a parent category.


Below is the code i am using, could anyone suggest how i could achieve showing any child category selected under a parent category.


Thanks



<?php
/**
* Single Product title
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 1.6.4
*/

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

global $post, $product;

$cat_count = sizeof( get_the_terms( $post->ID, 'product_cat' ) );
?>

<h1 itemprop="name" class="product_title entry-title"><?php the_title(); ?></h1>

<?php echo $product->get_categories( ', ', '<span class="posted_in">' . _n( 'Artist:', 'Artist:', $cat_count, 'woocommerce' ) . ' ', '.</span>' ); ?>

Link to comment
https://forums.phpfreaks.com/topic/293460-wordpress-woocommerce-advice/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.