Ocean WP & Woocommerce Product Archive Description
-
Hello, just thought this would be useful to others. Perhaps it could be put in the documentation.
Trying to add a description to the archive product page below the image is harder than it needs to be.
This just needs to be added to functions.php. It is the long description as the short goes next to the main product on the single page so this way you can just put in long without it affecting the single page (unless you’re putting long in tabs below).
add_action( 'ocean_after_archive_product_description', 'wc_add_long_description' ); /** * WooCommerce, Add Long Description to Products on Shop Page with Character limit * */ function wc_add_long_description() { global $product; ?> <div itemprop="description"> <?php echo substr( apply_filters( 'the_content', $product->post->post_content ), 0,140 ); echo '...' ?> </div> <?php }
Maybe there’s a better way this does work and could be useful to someone.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Ocean WP & Woocommerce Product Archive Description’ is closed to new replies.