Hi
I am using woocomerce and i would like the single product page to show the main product category in the title instead of the shop page title or the shop page title + the category title.
Hi
I am using woocomerce and i would like the single product page to show the main product category in the title instead of the shop page title or the shop page title + the category title.
Hi There,
Thanks for writing in! To assist you with this issue, we’ll first need you to provide us with your product page URL. I am not sure at the moment if you are referring to product page title or the breadcrumbs part.
This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.
Thank you.
Hi
Sorry for taking so long to reply. My product page url is
https://bajanart.com/gallery/artists-alliance-barbados/wata-transformation/
Hi again,
You can add the following code in your Child Theme’s functions.php file:
function wpa89819_wc_single_product(){
$product_cats = wp_get_post_terms( get_the_ID(), 'product_cat' );
if ( $product_cats && ! is_wp_error ( $product_cats ) ){
$single_cat = array_shift( $product_cats ); ?>
<h2 itemprop="name" class="product_category_title"><span>Category: <?php echo $single_cat->name; ?></span></h2>
<?php }
}
add_action( 'woocommerce_single_product_summary', 'wpa89819_wc_single_product', 2 );
Let us know how this goes!
Hi Nabeel,
Sorry this is not what i need. I would like the breadcrumbs to show the full path e.g Online Galleries > Artists Alliance > Remnant > Artwork Name where users can easily navigate back to the Artists Alliance category or the shop page. Also I would like the product page title to show the “primary” category the product is in. Example in the link i sent previously the product was in the Remnant category which I would like displayed on the left as shown in the image below and not the shop page title.
Hi There,
Thank you for the clarification.
Look for x_breadcrumbs() on this file: wp-content\themes\x\framework\functions\global\breadcrumbs.php. That is the function responsible for the breadcrumbs. Feel free to copy the entire x_breadcrumbs() function code on your child theme functions.php file and edit accordingly… Then you might need this function: https://codex.wordpress.org/Function_Reference/get_category_parents
For the title look for _landmark-header.php on this wp-content\themes\x\framework\legacy\cranium\headers\views\renew. That’s the file responsible for the title. Copy the file on the same folder on your child theme here: wp-content\themes\x-child\framework\legacy\cranium\headers\views\renew. If the folder doesn’t exist, please create it. Then adjust it to accordingly to add the Primary category product.
In case you are not comfortable making these changes yourself, we do have an in-house custom development team that offer paid services, who may be able to assist. They can be contacted at pinnacle@theme.co if this is of interest to you. If you have any further questions about the theme, we are more than happy to provide you with assistance on these inquiries.
Thank you for your understanding.