Ericka Lu
Forum Replies Created
-
This is perfect:
printf(‘<span class=”hide-on-related”>%s</span>’, $limit_desc);
Ironically the conditional tags were not working at all for us. I checked the code so many times I know there was nothing wrong with it. But the css solution was what we were looking for originally and it works perfect!
You have been such a great help! I’m absolutely positively sure dozens of developers in the future will be reading this thread and will be utilizing your knowledge in this particular situation. Once again we want to thank you so much! You are awesome! 😉
- This reply was modified 5 years, 2 months ago by Ericka Lu.
However this code works:
add_action('woocommerce_after_shop_loop_item_title', 'show_short_desc_in_archive_item', 2); function show_short_desc_in_archive_item () { global $product; $short_desc = apply_filters( 'woocommerce_short_description', $product->get_short_description() ); //change the value "30" to your desired word length $limit_desc = substr($short_desc, 0, 30); echo $limit_desc; }so maybe this is what’s causing it????:
if(is_category( $category )) {
echo $limit_desc;
}So the code we are using is:
add_action('woocommerce_after_shop_loop_item_title', 'show_short_desc_in_archive_item', 2); function show_short_desc_in_archive_item () { global $product; $short_desc = apply_filters( 'woocommerce_short_description', $product->get_short_description() ); //change the value "30" to your desired word length $limit_desc = substr($short_desc, 0, 30); if(is_category( $category )) { echo $limit_desc; } }and it’s not working for us.
Hi.
We did see the https://codex.ww.wp.xz.cn/Conditional_Tags
and did make the changes but it’s still not working.A Category Page
is_category( $category )
When the actual page is associated with the $category Category.
is_category( ‘9’ )
When the archive page for Category 9 is being displayed.
is_category( ‘Stinky Cheeses’ )
When the archive page for the Category with Name “Stinky Cheeses” is being displayed.
is_category( ‘blue-cheese’ )
When the archive page for the Category with Category Slug “blue-cheese” is being displayed.It’s not working for us. We are actually using a wordpress category template with the woocommere short code. We can’t even set that category page in the “shop” Woocommerce settings option from the drop down menu. We looked at the additional conditional tags but there is not an option for just “categories”. There is an option for “Product categories” but not just for “categories” which the shop design template is based off. If the product short description had a css class then we could always use css to display: none on other pages other than the page we want it to display on. We appreciate all your hard work and know that other future people in this situation will benefit off your knowledge as well.
Thank you!
This is awesome! Looks beautiful in our shop page. When we view it on the single product pages the descriptions still comes up on the bottom of the page on related products which of course no one wants that. When we tried to hide it with css class woocommerce-LoopProduct-link woocommerce-loop-product__link it’s not working. How can we still have the description on the shop page but not on the related products. We know that it is css but can’t find that actual css class for the description. Please help and we will leave you alone after this. Thank you so much!
Is it possible to show excerpts with the short code with the limit? Thanks!
Forum: Plugins
In reply to: [Auto-Install Free SSL – Generate & Install Free SSL Certificates] NGINXWe are using Digital Ocean VPS with no cpanel. We are using runcloud