Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialYan Cruz
20,439 PointsNeed help with some code.
I have been practicing with my WordPress site, and I want to know how to put a short description below the products.
I'm using WooCommerce and I'm 1/2 way.
I have the descriptions under the products, but I want to take only 4 of the descriptions, instead of all of them to be below the product.
What code can I use to do this?
4 Answers
Yan Cruz
20,439 PointsI'm using:
"<?php echo apply_filters( 'woocommerce_short_description', $post->post_excerpt ); ?>"
Is there nothing I need to change in this code?
Zac Gordon
Treehouse Guest TeacherHi, I'm not sure what you mean by you have 4 descriptions and you only want 1.
Yan Cruz
20,439 PointsSorry, Zac. I should had been a little more specific.
I did a dummy product with a list of numbers that go from 1-8
When I wrote the post_excerpt code, all of the numbers were outside of the products, as it should be.
But I want to know if there's a code that would allow me to only make 4 out of the 8.
Right now, I have it as: -1 -2 -3 -4 -5 -6 -7 -8
Want a want is a code that would allow me to keep the 1-8 inside the product, but only see the 1-4 below the product
Yan Cruz
20,439 PointsAs you can see, I'm not the best explaining lol.
Hopefully, you can understand what I tried to say