April 19, 2015 at 11:29 am
I use [gallery masonry="false" columns="6" ids="1896,1903"] in the product gallery short description. This causes layout problems (and slow loading due to big image files) on the /shop/ page. See this screenshot: *Login to see link
I thought of removing the gallery shortcode from the woocommerce short description on the shop page (a.k.a the_excerpt) using a filter with:
/* 2015-04-19: Do not print gallery on /shop/ - because does not work with long list */
function remove_shortcode_from_shop( $content ){
if ( is_shop() ) {
$content = strip_shortcodes( $content );
}
return $content;
}
add_filter( 'woocommerce_short_description', 'remove_shortcode_from_shop' );
But the woocommerce_short_description filter does not seem to be applied on the shop page, only on product pages. Using the the_excerpt wordpress filter is also not applied here.
I looked at your code and the relevant part is in content-product.php:
<div class="product_excerpt">
<?php global $post;
if ($post->post_excerpt){
echo do_shortcode(wpautop(wptexturize($post->post_excerpt)));
} else {
the_excerpt();
} ?>
</div>
Hmh, I am now stuck here :-/ Any advice how to remove the gallery shortcode from shop page? Is there a filter or anything else?
I know that there is a virtue premium option (“shop_excerpt”) to turn off the product short description completely. But that is not what I want, just removing the gallery would be ok.
PS Besides fixing the gallery rendering problem as shown in the screenshot would be cool too. Maybe this is just a missing initialisation. Then only the slow loading would remain due to the big files, where you of course cannot do much against (except maybe smaller thumbnails).