New Landing How can we help? Themeforest Theme Support Neighborhood Child Theme Not Changing Number Of Columns In Shop

Viewing 10 posts - 1 through 10 (of 10 total)
  • #309496
    dandanwell
    Member
    Post count: 14

    Hi,
    I wanted to change the number of products displayed in a row from 3 to 4 or 5 maybe.

    I have added the code from another topic into my child theme function file, but it hasn’t had any affect on my shop page.
    I have been through and disabled all my other plugins but still the product page stays at 3 products in a row.

    Can you help?

    I would like to see what the “shop” page looks like with products in 4 or 5 columns, and the sidebar on the left.

    How can I do this?
    What am I doing wrong?

    Thanks in advance.

    Daniel

    #309525
    dandanwell
    Member
    Post count: 14

    Hi,
    I seem to have 2 “shop” pages, could this have something to do with it?

    I had a lot of trouble installing the demo content and I think it left duplicate things in a lot of places, I tried to delete them all.

    regards
    Daniel

    #309722
    David Martin – Support
    Moderator
    Post count: 20834

    Hi Daniel,

    Can you link me to the tread you have used as reference? Will also need your FTP details to check what you have done.

    You can simply delete those extra pages.

    #309740
    dandanwell
    Member
    Post count: 14
    This reply has been marked as private.
    #309927
    David Martin – Support
    Moderator
    Post count: 20834

    Oh wow that is around 3 years old!

    In the child theme create this folder woocommerce.

    Inside that new folder copy and paste these two files from the parent theme:

    archive-product.php
    content-product.php

    Inside those two files you can then change both the columns counts:

    	if ( empty( $woocommerce_loop['columns'] ) ) {
    		global $sidebars;
    		$columns = 5;
    		
    		if ( $sidebars == "no-sidebars" || is_singular('portfolio') ) {
    			$columns = 5;
    		} else if ( $sidebars == "both-sidebars" ) {
    			$columns = 3;
    		} else {
    			$columns = 4;
    		}
    		$woocommerce_loop['columns'] = $columns;
    	}

    When you change the column counts in the PHP files, you must then update the CSS to reflect the new columns. So 4 columns + a sidebar would be (i’ve added this to your Theme Options):

    @media only screen and (min-width: 1200px)
    body.woocommerce .has-one-sidebar ul.products li.product {
        width: 195px;
    }
    }
    body.woocommerce .has-one-sidebar ul.products li.product {
        width: 160px;
    }
    #309967
    dandanwell
    Member
    Post count: 14

    Hi David,
    Thanks so much for your help.

    I can see where you have added the extra files and the css in my theme, thank you so much.

    However, I think there is a little problem with the css.

    Can you just have another quick look back at my shop page, link above, the css is not reducing the thumbnail sizes, so they are not wrapping into a row of 4?

    Thanks again
    Daniel

    #310051
    David Martin – Support
    Moderator
    Post count: 20834

    Glad to help you out.

    I updated the CSS to this and it now works as expected:

    body.woocommerce .has-one-sidebar ul.products li.product {
        width: 160px;
    }
    @media only screen and (min-width: 1200px){
    body.woocommerce .has-one-sidebar ul.products li.product {
        width: 195px;
    }
    }
    #310076
    dandanwell
    Member
    Post count: 14

    That’s great David,
    Thanks for all your brilliant help.

    You can close this off now.

    Best regards
    Daniel

    #310082
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    great. Thanks David.

    -Rui

    #310083
    David Martin – Support
    Moderator
    Post count: 20834

    I’m glad I could help you out.

    If you have found the theme/support useful, we appreciate it if you can leave feedback on our item if you have the time as it really helps us out.

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register