Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1245
    js2020
    Participant

    I have categories listed for my shop page and cannot change the number of columns using the following filter in my child theme’s function.php file:

    add_filter( 'loop_shop_columns', 'wc_loop_shop_columns', 1, 10 );
    
    function wc_loop_shop_columns( $number_columns ) {
    	return 2;
    }

    I would prefer to add a filter rather than a plug-in. Any ideas on how I can get this to work? Currently it has no effect. Thank you..

    #1246
    Nermin
    Keymaster

    Hi Js2020,

    try to use the below code and feed me back with the results

    remove_filter( 'loop_shop_columns', 'leap_loop_columns', 10 );
    
    add_filter( 'loop_shop_columns', 'wc_loop_shop_columns', 1, 10 );
    
    function wc_loop_shop_columns( $number_columns ) {
    	return 2;
    }

    Thanks,
    Bassem

    #1247
    js2020
    Participant

    No, unfortunately it didn’t work.

    #1249
    Nermin
    Keymaster

    Hi Js2020,
    Try to use the below code and feed me back with the results

    
    function child_remove_parent_function() {
        remove_filter( 'loop_shop_columns', 'leap_loop_columns', 10 );
    }
    add_action( 'init', 'child_remove_parent_function' );
    
    function wc_loop_shop_columns() {
    	return 2;
    }
    add_filter( 'loop_shop_columns', 'wc_loop_shop_columns', 10 );
    

    Thanks,
    Bassem

    #1355
    js2020
    Participant

    That worked! Thanks so much,

    Jennifer

    #1356
    Nermin
    Keymaster

    Hi Jennifer,

    I’m so glad 🙂 that everything is working well now.
    If you liked Wiz please consider rating us at Themeforest that will be so useful for our continuity, You can Click Here to Rate us Now.

    Thanks,
    Bassem

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Wiz Community Support’ is closed to new topics and replies.