Support » Plugin: WooCommerce » Wrap ul.products in a div without changing shop base page

  • Molly Mop



    I’m wondering if anyone can help.

    I’m trying to wrap the ul.products in a div called right-col so i can set a width and float it right.

    As of now i have a left-col in that holds the sidebar but if the sidebar doesn’t have much in, the products fall underneath it which i don’t want.
    I could set the height of the left-col but once the products go beyond that height they’ll again fall underneath the left-col.

    I’m trying to get this right-col div into it by placing it in the archive-product.php page but it wraps the ul.products and only 1 product within that and then the other products end up out side of the div and the unordered list. I’ve tried adding it like so in functions.php with no luck :

    add_action( 'woocommerce_before_shop_loop', 'my_theme_rightcol_start',10);
    add_action( 'woocommerce_after_shop_loop', 'my_theme_rightcol_end',10);
    function my_theme_rightcol_start() {
      echo '<div class="right-col clearfix">';
    function my_theme_rightcol_end() {
      echo '</div>';

    and also placing it before and after in loop-start.php and loop-end.php in woocommerce > loop folders.
    <ul class="products">

    it renders like so with every option:

    <div class="right-col clearfix">
    <ul class="products">
    <li class="post-50 product type-product status-publish hentry first sale instock"></li>
    <li class="post-85 product type-product status-publish hentry sale instock"></li>
    <li class="post-68 product type-product status-publish hentry last sale instock"></li>
    <li class="post-101 product type-product status-publish hentry first sale instock"></li>

    It’s probably very simple. I don’t want the right-col wrapper to take affect on the shop base page as this is displaying only categories full width. I was able to remove the sidebar from the shop base page by unregistering it in functions.php with is_shop() so i’m guessing you could unregister it also.

    Any ideas?

    Thanks in advance

  • The topic ‘Wrap ul.products in a div without changing shop base page’ is closed to new replies.