Home / Forums / WoodMart support forum / Short Description on Shop Page
Home › Forums › WoodMart support forum › Short Description on Shop Page
Short Description on Shop Page
- This topic has 9 replies, 2 voices, and was last updated 2 years, 4 months ago by
Aizaz Imtiaz Awan.
-
AuthorPosts
-
March 14, 2024 at 9:23 am #548955
shwetaParticipantHello,
I have added a short description on my store page. When someone clicks on the ellipsis, they will see the full description, which will be 8-10 words long. For better understanding, please find the attached screenshot.
Best
Attachments:
You must be logged in to view attached files.March 14, 2024 at 1:58 pm #549045Hello,
You are using the PHP code to show the short description in the shop page. You need to define the class in the PHP Code.
Like this:
add_action( 'woocommerce_after_shop_loop_item_title', 'pk_shop_product_short_description', 35, 2 ); function pk_shop_product_short_description() { echo '<div class="shop-description">'; the_excerpt(); echo '</div>'; }Then, add the following custom css code in the theme settings to control the description.
.shop-description { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 3; /* Number of lines to show */ -webkit-box-orient: vertical; }Best Regards.
March 14, 2024 at 3:52 pm #549080
shwetaParticipantGetting this error when i added this code.
Error message:
Cannot redeclare pk_shop_product_short_description() (previously declared in /home/u162792289/domains/akshatraghava.website/public_html/wp-content/themes/woodmart/functions.php:72)
March 14, 2024 at 4:04 pm #549090Hello,
Please remove the old code and add new one.
Best Regards.
March 14, 2024 at 4:06 pm #549091
shwetaParticipantWhich new code? have you shared the code?
March 15, 2024 at 10:11 am #549231Hello,
Please remove the old code and add this code.
add_action( 'woocommerce_after_shop_loop_item_title', 'pk_shop_product_short_description', 35, 2 ); function pk_shop_product_short_description() { echo '<div class="shop-description">'; the_excerpt(); echo '</div>'; }Best Regards.
March 15, 2024 at 10:14 am #549235
shwetaParticipantHello,
I updated this code but still same issue.
March 15, 2024 at 1:57 pm #549345Hello,
After adding the PHP code, add the following custom css code in the theme settings to control the description.
.shop-description { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 3; /* Number of lines to show */ -webkit-box-orient: vertical; }Best Regards.
March 15, 2024 at 2:06 pm #549357
shwetaParticipantStill showing same issue, can you please check from your side i have already share the wp login details. please check its very urgent for me.
March 15, 2024 at 3:47 pm #549396Hello,
Now Check back your site and check the issue. You can set the Number of lines to show in for the sort description in the custom css code.
Best Regards.
-
AuthorPosts
- You must be logged in to create new topics. Login / Register