Support » Plugin: WooCommerce » Adjustint li in ul.products

Viewing 9 replies - 1 through 9 (of 9 total)
  • Roy Ho

    (@splashingpixelscom)

    What are you trying to do?

    Adding the class span4 to the <li class=”post-1561 ..”>

    Roy Ho

    (@splashingpixelscom)

    And where is this UL list being generated from?

    The shop home so http://website.com/shop on the main woocommerce shop page

    Roy Ho

    (@splashingpixelscom)

    Ok you can copy the file content-product.php from your WC plugins folder within templates and paste into your theme folder woocommerce folder templates keeping the same structure.

    Then you can modify the content-product.php to your liking. The li tag is in that file.

    Roy Ho

    (@splashingpixelscom)

    Or…it may be possible to filter it by post_class like.

    add_filter( 'post_class', 'yourfunction' );

    Not sure about this one but worth a try and you may need to target the post type since post_class is used in different places…

    Thank you, I found it! How blind of me

    Roy Ho

    (@splashingpixelscom)

    Here is an even better solution where you don’t need to copy the template.

    add_filter( 'post_class', 'addspan' );
    
    function addspan( $classes ) {
     	if ( is_shop() ) {
    		$classes[] = 'span4';
    		return $classes;
    	}
    }

    Thanks a lot, that’s even better indeed

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Adjustint li in ul.products’ is closed to new replies.