- This topic has 15 replies, 3 voices, and was last updated 3 years, 7 months ago by David.
-
AuthorPosts
-
September 17, 2020 at 3:26 am #1446864limolab
Hello, in this page: https://shop.geogym.it/
Is it possible to show the category on the tile of the product?
Hope to be clear.
ThanksSeptember 17, 2020 at 3:55 am #1446889DavidStaffCustomer SupportHi there,
where would you want the Category name displayed ? Above the single product title ?
September 17, 2020 at 5:06 am #1446955limolabHello, yes on the tile, under the title.
Thanks.September 17, 2020 at 6:37 am #1447061DavidStaffCustomer SupportOk so try this:
1. Create a new Hook Element:
https://docs.generatepress.com/article/hooks-element-overview/
2. Add this code to the Hook element text area:
<?php $terms = get_the_terms( $post->ID, 'product_cat' ); if ( $terms && ! is_wp_error( $terms ) ) : if ( isset( $terms ) ) { echo '<span class="woo-cat-term">' . $terms[0]->name . '</span>'; }?> <?php endif;?>
3. Select the
woocommerce_single_product_summary
hook from the hook list
4. Check Execute PHP
5. Set the Priority to9
6. On Display Rules set Location to Products > All ProductsSeptember 17, 2020 at 6:58 am #1447095limolabHi, thanks for your quick response.
woocommerce_single_product_summary_hook i can’t find this on the hook list, i find only this: woocommerce_single_product_summary, i don’t know if it’s the same.I’ve follow the procedure but still doesn’t work.
Hope to be clear.
ThanksSeptember 17, 2020 at 7:08 am #1447108DavidStaffCustomer SupportOops – that was my typo – yes thats the correct hook. I corrected the code above.
I just checked your site and I can see the Category below the title on the Single Product page.
Do you want this to appear in the Product Archives ?
September 17, 2020 at 7:14 am #1447114limolabHello. No problem 🙂
yeah i’d like to see the category on the tiles in the home page.
In this section:-> I PRODOTTI GEOGYM
Is it possible to do that?
Thanks.September 17, 2020 at 7:38 am #1447138DavidStaffCustomer SupportChange the Display Rules to
Product Archive
which is the Shop Page.September 17, 2020 at 7:50 am #1447310limolabHi, thanks for yor response.
Can you be please more specific?
Where can i find “Product Archive” ?Thanks
September 17, 2020 at 8:25 am #1447356LeoStaffCustomer SupportSHould be in the display rules towards the bottom:
https://www.screencast.com/t/5bCGgFFEUoBxSeptember 17, 2020 at 8:36 am #1447377limolabHello.
Thanks for your response.
unfortunately still doesn’t work.
I can give you the access to my site if you want.
Thanks.September 17, 2020 at 8:44 am #1447386LeoStaffCustomer SupportSorry what doesn’t work? The display rules?
September 17, 2020 at 8:47 am #1447388limolabYes, i’d like to show the category name under the title of the product in this page -> https://shop.geogym.it/
But as you can see it show only the title of the product and not the category.
Hope to be clear.
ThanksSeptember 17, 2020 at 9:24 am #1447431DavidStaffCustomer SupportFollow the steps here:
https://generatepress.com/forums/topic/show-category-on-woo-coomerce-tiles/#post-1447061
And set the following Display Rules to:
1. Location > Product Archive
2. Location > Product Category Archives > All Archives.September 18, 2020 at 12:37 am #1448163limolabHello,
I’ve follow the steps.
Still doesn’t work.
see the screenshot.
If you want i can give you the access.Thanks
-
AuthorPosts
- You must be logged in to reply to this topic.