If you are like me, you have some clients whom have some product descriptions that are very long and others that are very short. I personally did not like the way wp e-commerce simply just displayed the full description, making each product default page look in my option unprofessional. To solve this issue, I modified the wp e-commerce theme to display a 50 word excerpt of the full description.
Note: Remember to make a copy of any wp e-commerce theme to your WordPress theme. There is a simple move tool under the Presentation tab of the store settings to make this easy. NEVER modify the default theme in wp e-commerce theme due any updates made to wp e-commerce will overwrite the work you have done.
What you will want to do is copy the wp-products_pages.php file to your theme. Download it to your computer so you may edit it. Go to line 106 (shown below)
106 107 108 | <div class="wpsc_description"> <?php echo wpsc_the_product_description(); ?> </div><!--close wpsc_description--> |
Make the following change:
106 107 108 109 110 111 112 113 114 115 | <div class="wpsc_description"> <?php $fulldesc = wpsc_the_product_description(); $excerptdesc = implode(' ', array_slice(explode(' ', $fulldesc), 0, 50)); echo $excerptdesc; //Text you want to shorten goes here ?> </div><!--close wpsc_description--> <div class="wpsc_description"></div> <!--?php echo wpsc_the_product_description(); ?--> <!--close wpsc_description--> |
It’s that simple to produce an excerpt of your product description.
Contact: