Tagged: x
-
AuthorPosts
-
April 19, 2016 at 5:53 pm #890885
CodetrixNZParticipantHi Team,
I’m not exactly sure how to describe this, so in the next post I’ll supply login details for our development site and attach a screenshot.
We wanting to add the products category between the product title and the product price, when your viewing products in list view/shop page etc.We’re using the renew stack, but looking across the different stacks available, it doesn’t appear any of them do this.
Thank you!April 19, 2016 at 5:55 pm #890888
CodetrixNZParticipantThis reply has been marked as private.April 20, 2016 at 6:08 am #891574
ZeshanMemberHi Aaron,
Thanks for writing in!
Product categories only appear under single product page. It could be possible to add them in the main shop page with custom development. While that is outside the scope of support, I could point you in the right direction with the understanding that it would ultimately be your responsibility to take it from here.
Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.
After that, add following code in your child theme’s functions.php file:
// Add Category in Between Product Title and Price // ============================================================================= function category_after_shop_loop_item_title() { $categories = get_the_terms( get_the_ID(), 'product_cat' ); $separator = ', '; $categories_output = ''; if ( ! empty( $categories ) ) { foreach ( $categories as $category ) { $categories_output .= '<a href="' . get_term_link( $category->slug, 'product_cat' ) . '" title="' . esc_attr( sprintf( __( "View all posts in: “%s”", '__x__' ), $category->name ) ) . '">' . $category->name . '</a>' . $separator; } } $categories_list = sprintf( '<span class="product-categories">%s</span>', trim( $categories_output, $separator ) ); echo $categories_list; } add_action( 'woocommerce_after_shop_loop_item_title', 'category_after_shop_loop_item_title', 9 );Hope this helps. 🙂
Thank you!
April 20, 2016 at 4:41 pm #892543
CodetrixNZParticipant….You know you guys are legends right?!
Most support teams would just say go away and ask else where.
THIS is a big reason why we will continue to support this theme & team. Thank you, your time, its very much appreciated.April 21, 2016 at 4:03 am #893312
LelyModeratorYou’re welcome!
Cheers!
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-890885 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
