Override a WordPress parent theme function

Solution:

Function of child theme is executed first and then parent theme’s. Checking using function_exists should have been done in parent theme.

To overcome this you can remove parent theme’s hook and hook your custom function to same filter.

remove_filter('loop_shop_columns', 'pt_loop_shop_columns');

add_filter('loop_shop_columns', 'custom_pt_loop_shop_columns');

function custom_pt_loop_shop_columns(){
    global $wp_query;
    if ( 'layout-one-col' == pt_show_layout() ) return 4;
    else return 4;
}