WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Adjustint li in ul.products (10 posts)

  1. netraam24
    Member
    Posted 1 year ago #

    <ul class="products">
    					<li class="post-1561 product type-product status-publish hentry first featured instock">
    
    	Image
    	Price
    	Add to cart
    
    </li>
    			</ul>

    This is the current setup of an li in ul.products.. how can I for example add a class to the class list in the li?

    http://wordpress.org/extend/plugins/woocommerce/

  2. Roy Ho
    Member
    Posted 1 year ago #

    What are you trying to do?

  3. netraam24
    Member
    Posted 1 year ago #

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

  4. Roy Ho
    Member
    Posted 1 year ago #

    And where is this UL list being generated from?

  5. netraam24
    Member
    Posted 1 year ago #

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

  6. Roy Ho
    Member
    Posted 1 year ago #

    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.

  7. Roy Ho
    Member
    Posted 1 year ago #

    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...

  8. netraam24
    Member
    Posted 1 year ago #

    Thank you, I found it! How blind of me

  9. Roy Ho
    Member
    Posted 1 year ago #

    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;
    	}
    }
  10. netraam24
    Member
    Posted 1 year ago #

    Thanks a lot, that's even better indeed

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.