Tagged: woocommerce
-
AuthorPosts
-
July 29, 2020 at 4:51 pm #1233983
Hi support
Is it possible to add a tag or a text below the title displayed in the Enfold product slider like this :
[Image]
Title of the product
Extra text line (like tag list for instance)
PriceIs it possible by modifying the template or adding a function ?
Many thanks !
August 2, 2020 at 2:13 pm #1234609Hey Ikyo,
We apologize for the delayed response.
Yes, it’s possible by using woocommerce hook: woocommerce_after_shop_loop_item_title
The slider just fetches the format woocommerce provides and put it in the slider.
Let us know if you need further assistance :)Best regards,
NikkoAugust 3, 2020 at 10:44 am #1234772Many thanks Nikko
I’ve tried to applicate such a hook in a code like
//function add tag in WooCommerce product add_action( 'woocommerce_after_shop_loop_item_title', 'show_tags', 20 ); function show_tags() { global $product; // get the product_tags of the current product $current_tags = get_the_terms( get_the_ID(), 'product_tag' ); // only start if we have some tags if ( $current_tags && ! is_wp_error( $current_tags ) ) { //create a list to hold our tags echo '<div class="auteurs_tags">'; echo 'par :'; // for each tag we create a list item foreach ( $current_tags as $tag ) { $tag_title = $tag->name; // tag name $tag_link = get_term_link( $tag ); // tag archive link echo '<a href="'.$tag_link.'">'.$tag_title.'</a>'; } echo '</div>'; } }
The problem is each product is presented as follows :
[Image]
Title of the product
Price
Extra text line (like tag list for instance)While I will desire :
[Image]
Title of the product
Extra text line (like tag list for instance)
PriceMany thanks for your kindful help
- This reply was modified 4 years, 4 months ago by Ikyo.
August 4, 2020 at 5:04 pm #1235122Hi Ikyo,
Thanks for posting your code for review.
Please replace this part of the code:add_action( 'woocommerce_after_shop_loop_item_title', 'show_tags', 20 );
to:
add_action( 'woocommerce_after_shop_loop_item_title', 'show_tags', 7 );
Best regards,
NikkoAugust 4, 2020 at 5:29 pm #1235130Ah, really fantastic.!
Many thanks NikkoKinds regards
August 4, 2020 at 5:32 pm #1235132Hi Ikyo,
We’re glad that we could help :)
Thanks for using Enfold and have a great day!Best regards,
Nikko -
AuthorPosts
- The topic ‘Add text below Title in Woocommerce slider’ is closed to new replies.