Hi I want to remove the :last class from the last li in the woocommerce related products div located on the single product page, e.g here:
http://pbs.transparentwebdesigns.co.uk/p/morphy-richards-colour-accents-pyramid-cordless-kettle-1-5-litres/
what code do I need to add to functions.php to do this? I think the :last class is generated by Wordpress but don't know how to override it. I only want to do it on the related poducts div nowhere else on the site...
Albert Shala answers:
Try something like this in your css .class-name:nth-child() { display:none; }
willcm comments:
Sorted myself edited theme/woocommerce/content-product.php:
// Extra post classes
if (!is_product()) {
$classes = array();
if ( 0 == ( $woocommerce_loop['loop'] - 1 ) % $woocommerce_loop['columns'] || 1 == $woocommerce_loop['columns'] )
$classes[] = 'first';
if ( 0 == $woocommerce_loop['loop'] % $woocommerce_loop['columns'] )
$classes[] = 'last';
}
Albert Shala comments:
This would do it:
.related-carousel ul li:nth-last-child(1) {
display:none !important;
}