function pbosfc_list_products($atts, $func)
{
    $latts = shortcode_atts(['class' => '', 'max_rows' => 1, 'title' => ''], $atts);
    ob_start();
    call_user_func($func, $latts['class'], $latts['max_rows'], pbosfc_get_option('product_columns'), $latts['title']);
    return ob_get_clean();
}
function pbosfc_add_customizer_css()
{
    $header_background_color = storefront_sanitize_hex_color(get_theme_mod('storefront_header_background_color', apply_filters('storefront_default_header_background_color', '#2c2d33')));
    $header_link_color = storefront_sanitize_hex_color(get_theme_mod('storefront_header_link_color', apply_filters('storefront_default_header_link_color', '#ffffff')));
    $footer_text_color = storefront_sanitize_hex_color(get_theme_mod('storefront_footer_text_color', apply_filters('storefront_default_footer_text_color', '#61656b')));
    $product_column_width = (int) pbosfc_get_option('product_columns');
    $product_column_width = 100 / ($product_column_width !== 0 ? $product_column_width : 1) - 2;
    $brighten_factor = apply_filters('storefront_brighten_factor', pbosfc_brighten_factor());
    $darken_factor = apply_filters('storefront_darken_factor', pbosfc_darken_factor());
    $left_top_menu_width = (string) pbosfc_get_option('left_top_menu_width') . "%";
    $left_top_menu_align = (string) pbosfc_get_option('left_top_menu_align');
    $right_top_menu_width = (string) pbosfc_get_option('right_top_menu_width') . "%";
    $right_top_menu_align = (string) pbosfc_get_option('right_top_menu_align');
    // TODO: (not importrant) umozliwic ustawianie doklaniej kolorow top menu
    $top_menu_background_color = storefront_sanitize_hex_color(get_theme_mod('pbosfc_top_menu_background_color', pbosfc_get_option_def('top_menu_background_color')));
    $top_menu_1level_background_color = $top_menu_background_color;
    //'#f3f3f3';
    $top_menu_1level_link_color = storefront_sanitize_hex_color(get_theme_mod('pbosfc_top_menu_1level_link_color', pbosfc_get_option_def('top_menu_1level_link_color')));
    $top_menu_2level_background_color = $top_menu_background_color;
    //'#f3f3f3';
    $top_menu_2level_link_color = $top_menu_1level_link_color;
    //'#96588a';
    // TODO: (not importrant) umozliwic ustawianie dokladniej kolorow glownego menu
    $main_navigation_1level_background_color = $header_background_color;
    //'#2c2d33';
    $main_navigation_1level_link_color = $header_link_color;
    //'#ffffff';
    $main_navigation_2level_background_color = $header_background_color;
    //'#2c2d33';
    $main_navigation_2level_link_color = $header_link_color;
    //'#ffffff';
    $main_navigation_text_align = pbosfc_get_option('main_navigation_text_align');
    $site_title_link_color = storefront_sanitize_hex_color(get_theme_mod('pbosfc_site_title_link_color', pbosfc_get_option_def('site_title_link_color')));
    $site_title_text_color = storefront_sanitize_hex_color(get_theme_mod('pbosfc_site_title_text_color', pbosfc_get_option_def('site_title_text_color')));
    $site_header_search_background_color = storefront_sanitize_hex_color(get_theme_mod('pbosfc_site_header_search_background_color', pbosfc_get_option_def('site_header_search_background_color')));
    $site_header_search_text_color = storefront_sanitize_hex_color(get_theme_mod('pbosfc_site_header_search_text_color', pbosfc_get_option_def('site_header_search_text_color')));
    $site_header_cart_background_color = storefront_sanitize_hex_color(get_theme_mod('pbosfc_site_header_cart_background_color', pbosfc_get_option_def('site_header_cart_background_color')));
    $site_header_cart_link_color = storefront_sanitize_hex_color(get_theme_mod('pbosfc_site_header_cart_link_color', pbosfc_get_option_def('site_header_cart_link_color')));
    $site_header_cart_content_background_color = storefront_sanitize_hex_color(get_theme_mod('pbosfc_site_header_cart_content_background_color', pbosfc_get_option_def('site_header_cart_content_background_color')));
    $site_header_cart_content_link_color = storefront_sanitize_hex_color(get_theme_mod('pbosfc_site_header_cart_content_link_color', pbosfc_get_option_def('site_header_cart_content_link_color')));
    $site_header_cart_content_text_color = storefront_sanitize_hex_color(get_theme_mod('pbosfc_site_header_cart_content_text_color', pbosfc_get_option_def('site_header_cart_content_text_color')));
    $onsale_sign_background_color = storefront_sanitize_hex_color(get_theme_mod('pbosfc_onsale_sign_background_color', pbosfc_get_option_def('onsale_sign_background_color')));
    $onsale_sign_border_color = storefront_sanitize_hex_color(get_theme_mod('pbosfc_onsale_sign_border_color', pbosfc_get_option_def('onsale_sign_border_color')));
    $onsale_sign_text_color = storefront_sanitize_hex_color(get_theme_mod('pbosfc_onsale_sign_text_color', pbosfc_get_option_def('onsale_sign_text_color')));
    $styles = "\n\t\t/* Fixing some Storefront bugs ;) */\n\n\t\t.footer-widgets ul.menu li.current-menu-item > a {\n\t\t\tcolor: {$footer_text_color};\n\t\t}\n\n\t\t/* Site title */\n\n\t\tul.menu li a,\n\t\t.site-title a,\n\t\t.site-branding h1 a {\n\t\t\tcolor: {$site_title_link_color};\n\t\t}\n\t\t.site-title a:hover,\n\t\t.site-branding h1 a:hover {\n\t\t\tcolor: " . storefront_adjust_color_brightness($site_title_link_color, $darken_factor) . ";\n\t\t}\n\t\tp.site-description {\n\t\t\tcolor: {$site_title_text_color};\n\t\t}\n\n\n\t\t@media screen and ( min-width: 768px ) {\n\n\t\t\t/* Category/product columns on archives pages */\n\n\t\t\t.site-main ul.products li.product {\n                width : {$product_column_width}%;\n                margin-right : 2%;\n                float: left;\n            }\n\n\t\t\t/* Top menu */\n\n\t\t\t.top-menu-wrap {\n\t\t\t\tbackground-color: {$top_menu_background_color};\n\t\t\t}\n\n\t\t\t.left-top-menu-wrap {\n\t\t\t\twidth    : {$left_top_menu_width};\n\t\t\t\tmin-width: {$left_top_menu_width};\n\t\t\t\tbackground-color: {$top_menu_1level_background_color};\n\t\t\t}\n\t\t    .left-top-menu .menu {\n\t\t        float    : {$left_top_menu_align};\n\t\t    }\n\n\t\t\t.right-top-menu-wrap {\n\t\t\t\twidth    : {$right_top_menu_width};\n\t\t\t\tmin-width: {$right_top_menu_width};\n\t\t\t\tbackground-color: {$top_menu_1level_background_color};\n\t\t\t}\n\t\t    .right-top-menu .menu {\n\t\t        float    : {$right_top_menu_align};\n\t\t    }\n\n\t\t\t.left-top-menu .menu a,\n\t\t\t.right-top-menu .menu a,\n\t\t\t.left-top-menu ul.menu li.current-menu-item > a,\n\t\t\t.right-top-menu ul.menu li.current-menu-item > a {\n\t\t\t\tcolor: {$top_menu_1level_link_color};\n\t\t\t\tbackground-color: {$top_menu_1level_background_color};\n\t\t\t}\n\n\t\t\t.left-top-menu .menu a:hover,\n\t\t\t.right-top-menu .menu a:hover,\n\t\t\t.left-top-menu ul.menu li.current-menu-item > a:hover,\n\t\t\t.right-top-menu ul.menu li.current-menu-item > a:hover {\n\t\t\t\tcolor: " . storefront_adjust_color_brightness($top_menu_1level_link_color, $darken_factor) . ";\n\t\t\t\tbackground-color: " . storefront_adjust_color_brightness($top_menu_1level_background_color, $brighten_factor) . ";\n\t\t\t}\n\n\t\t\t.left-top-menu .menu ul a,\n\t\t\t.right-top-menu .menu ul a {\n\t\t\t\tcolor: {$top_menu_2level_link_color};\n\t\t\t\tbackground-color: {$top_menu_2level_background_color};\n\t\t\t}\n\n\t\t\t.left-top-menu .menu ul a:hover,\n\t\t\t.right-top-menu .menu ul a:hover {\n\t\t\t\tcolor: " . storefront_adjust_color_brightness($top_menu_2level_link_color, $darken_factor) . ";\n\t\t\t\tbackground-color: " . storefront_adjust_color_brightness($top_menu_2level_background_color, $brighten_factor) . ";\n\t\t\t}\n\n\t\t}\n\n\t\t/* Main menu */\n\n\t\t/* first (and rest on mobile) level */\n\n\t\t.main-navigation,\n\t\t.main-navigation ul li a {\n\t\t\tcolor: {$main_navigation_1level_link_color};\n\t\t    background-color: {$main_navigation_1level_background_color};\n\t\t}\n\n\t\t.main-navigation ul li a:hover {\n\t\t\tcolor: " . storefront_adjust_color_brightness($main_navigation_1level_link_color, $darken_factor) . ";\n\t\t\tbackground-color: " . storefront_adjust_color_brightness($main_navigation_1level_background_color, $brighten_factor) . ";\n\t\t}\n\n\n\t\t@media screen and ( min-width: 768px ) {\n\n\t\t\t.woocommerce-active .site-header .main-navigation,\n\t\t\t.site-header .main-navigation {\n\t\t\t\ttext-align: {$main_navigation_text_align}\n\t\t\t}\n\n\t\t\t/* second level, desktops */\n\n\t\t\t.main-navigation ul.menu ul li a {\n\t\t\t\tcolor: {$main_navigation_2level_link_color};\n\t\t\t\tbackground-color: {$main_navigation_2level_background_color};\n\t\t\t}\n\t\t\t.main-navigation ul.menu ul li a:hover {\n\t\t\t\tcolor: " . storefront_adjust_color_brightness($main_navigation_2level_link_color, $darken_factor) . ";\n\t\t\t\tbackground-color: " . storefront_adjust_color_brightness($main_navigation_2level_background_color, $brighten_factor) . ";\n\t\t\t}\n\t\t}\n\n\n\t\t/* Wishlist link (on mobile) */\n\n\t\t.site-header-wishlist a {\n\t\t\tcolor: {$header_link_color};\n\t\t}\n\t\t.site-header-wishlist a:hover {\n\t\t\tcolor: " . storefront_adjust_color_brightness($header_link_color, $darken_factor) . ";\n\t\t}\n\n\t\t/* Search box */\n\n\t\t.widget_search form input[type=text],\n\t\t.widget_search form input[type=search],\n\t\t.widget_product_search form input[type=text],\n\t\t.widget_product_search form input[type=search] {\n\t\t\tbackground-color: {$site_header_search_background_color};\n\t\t\tcolor : {$site_header_search_text_color};\n\t\t}\n\n\t\t/* Mini Cart */\n\n\t\t.site-header-cart .cart-contents,\n\t\t.widget .site-header-cart .cart-contents,\n\t\t.woocommerce-active .site-header .site-header-cart {\n\t\t\tbackground-color : {$site_header_cart_background_color};\n\t\t\tcolor: {$site_header_cart_link_color};\n\t\t}\n\n\t\t.site-header-cart .widget_shopping_cart {\n\t\t\tbackground-color: {$site_header_cart_content_background_color};\n\t\t\tcolor: {$site_header_cart_content_text_color};\n\t\t}\n\t\t.site-header .product_list_widget li .quantity,\n\t\t.widget_shopping_cart .product_list_widget li .quantity {\n\t\t\tcolor: {$site_header_cart_content_text_color};\n\t\t}\n\n\t\ta.cart-contents,\n\t\t.widget a.cart-contents {\n\t\t\tcolor: {$site_header_cart_link_color};\n\t\t}\n\t\t.site-header-cart .widget_shopping_cart a {\n\t\t\tcolor: {$site_header_cart_content_link_color};\n\t\t}\n\t\ta.cart-contents:hover,\n\t\t.widget a.cart-contents:hover {\n\t\t\tcolor: " . storefront_adjust_color_brightness($site_header_cart_link_color, $darken_factor) . ";\n\t\t}\n\t\t.site-header-cart .widget_shopping_cart a:hover {\n\t\t\tcolor: " . storefront_adjust_color_brightness($site_header_cart_content_link_color, $darken_factor) . ";\n\t\t}\n\n\t\t/* On Sale sign */\n\n\t\t.woocommerce span.onsale {\n\t\t\tbackground-color: {$onsale_sign_background_color};\n\t\t\tborder-color: {$onsale_sign_border_color};\n\t\t\tcolor: {$onsale_sign_text_color};\n\t\t}\n\t";
    // Some fixes for Firefox (on Linux)
    $user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
    if ((bool) preg_match("/firefox/i", $user_agent)) {
        $styles = $styles . "\n\t\t\t/*@media screen and ( min-width: 768px ) {*/\n\t\t\t\t.site-branding h1 {\n\t\t\t\t\tfont-size : 1.35em;\n\t\t\t\t}\n\n\t\t\t\t.site-header-wishlist a {\n\t\t\t\t\tfont-size : 0.6em;\n\t\t\t\t}\n\n\t\t\t\t.woocommerce-active .site-header .main-navigation,\n\t\t\t\t.site-header .main-navigation {\n\t\t\t\t\tfont-size : 1.05em;\n\t\t\t\t}\n\t\t\t/*}*/\n\t\t";
    }
    $styles = pbo_compact_css($styles);
    wp_add_inline_style('pbosfc-style', apply_filters('pbosfc_inline_styles', $styles));
}
/**
 * Display the page header
 * PBO: options for featured image
 */
function storefront_page_header()
{
    ?>
	<header class="entry-header">
		<?php 
    if (pbosfc_get_option('page_featured_image_size') != 'none') {
        storefront_post_thumbnail(pbosfc_get_option('page_featured_image_size'));
    }
    the_title('<h1 class="entry-title" itemprop="name">', '</h1>');
    ?>
	</header><!-- .entry-header -->
	<?php 
}
/**
 * Breadcrumb always in shop (products, categories, etc.)
 * and on pages/posts only if option is ON.
 */
function pbosfc_woocommerce_breadcrumb($args = array())
{
    $display = true;
    if ('page' === get_post_type()) {
        $display = pbosfc_get_option('page_breadcrumb');
    } elseif ('post' === get_post_type()) {
        $display = pbosfc_get_option('post_breadcrumb');
    } elseif ('product' === get_post_type()) {
        $display = pbosfc_get_option('product_breadcrumb');
    }
    if ($display) {
        woocommerce_breadcrumb($args);
    }
}
/**
 * Display the post content
 * PBO: options for featured image
 */
function storefront_post_content()
{
    ?>
	<div class="entry-content" itemprop="articleBody">
		<?php 
    if (pbosfc_get_option('post_featured_image_size') != 'none') {
        storefront_post_thumbnail(pbosfc_get_option('post_featured_image_size'));
    }
    the_content(sprintf(__('Continue reading %s', 'storefront'), '<span class="screen-reader-text">' . get_the_title() . '</span>'));
    wp_link_pages(array('before' => '<div class="page-links">' . __('Pages:', 'storefront'), 'after' => '</div>'));
    ?>
	</div><!-- .entry-content -->
	<?php 
}
        ?>
 itemscope=""
				         itemtype="http://schema.org/BlogPosting">

					<?php 
        /**
         * @hooked storefront_post_header() - 10
         * @hooked storefront_post_meta() - 20
         * @hooked storefront_post_content() - 30
         */
        do_action('storefront_loop_post');
        ?>
				</article><!-- #post-## -->

				<?php 
        if ('post' != get_post_type() || !pbosfc_get_option('post_excerpt')) {
            ?>
					<div class="pbosfc_search_post_divider"></div><?php 
        }
        ?>
				<?php 
    }
    /**
     * @hooked storefront_paging_nav - 10
     */
    do_action('storefront_loop_after');
    ?>

		<?php 
} else {
    ?>
/**
 * Replace Woocommerce products search box with standard Wordpress search box
 */
function pbosfc_search()
{
    if (!pbosfc_get_option('use_wp_search')) {
        storefront_product_search();
    } else {
        ?>
		<div class="site-search">
			<?php 
        the_widget('WP_Widget_Search');
        ?>
		</div>
		<?php 
    }
}
<?php

/**
 * General
 */
// posts per page
add_action('pre_get_posts', function ($query) {
    if ($query->is_home() && $query->is_main_query()) {
        $query->set('posts_per_page', pbosfc_get_option('posts_per_page'));
    }
});
/**
 * Header
 */
add_action('storefront_before_header', 'pbosfc_topheader_1', 200);
add_action('storefront_before_header', 'pbosfc_topmenu', 300);
add_action('storefront_before_header', 'pbosfc_topheader_2', 400);
// Change fields order on mobile view: handheld menu then search box
remove_action('storefront_header', 'storefront_product_search', 40);
add_action('storefront_header', 'pbosfc_search', 55);
// Insert link to Wishlist into header
if (defined('YITH_WCWL')) {
    add_action('storefront_header', 'pbosfc_wishlist_link', 25);
}
/**
 * Posts
 */
// Apply the excerpt functionality
remove_action('storefront_loop_post', 'storefront_post_content', 30);
add_action('storefront_loop_post', 'pbosfc_post_excerpt', 30);
/**
<?php

/**
 * The template for displaying all pages.
 *
 * This is the template that displays all pages by default.
 * Please note that this is the WordPress construct of pages
 * and that other 'pages' on your WordPress site will use a
 * different template.
 */
/**
 * PBO: If breadcrumb on pages is enabled then show Homepage text here (as a breadcrumb).
 */
get_header();
if (is_front_page()) {
    if (pbosfc_get_option('page_breadcrumb')) {
        echo '<nav class="woocommerce-breadcrumb"><a href="">' . __('Homepage', 'pbosfc') . '</a></nav>';
    }
}
?>

	<div id="primary" class="content-area">
		<main id="main" class="site-main" role="main">

			<?php 
while (have_posts()) {
    the_post();
    ?>

				<?php 
    do_action('storefront_page_before');
 * Loop Add to Cart
 */
/**
 * PB:
 */
global $product;
// Availability
$availability = $product->get_availability();
$availability_html = empty($availability['availability']) ? '' : '<p class="stock ' . esc_attr($availability['class']) . '">' . esc_html($availability['availability']) . '</p>';
echo apply_filters('woocommerce_stock_html', $availability_html, $availability['availability'], $product);
global $add_to_cart_template_from_wishlist;
if (!pbosfc_get_option('add_to_cart_on_product_list')) {
    /* Only Read more button */
    echo sprintf('<a href="%s" class="button product_type_%s">%s</a>', esc_url(get_permalink()), esc_attr($product->product_type), esc_html(__('Read more', 'woocommerce')));
} else {
    if (!pbosfc_get_option('add_to_cart_with_quantity_on_product_list') || !$product->is_purchasable() || $product->product_type != 'variable' && $product->product_type != 'simple' || $add_to_cart_template_from_wishlist > 0) {
        /* Standard woocommerce output */
        echo apply_filters('woocommerce_loop_add_to_cart_link', sprintf('<a href="%s" rel="nofollow" data-product_id="%s" data-product_sku="%s" data-quantity="%s" class="button %s %s product_type_%s">%s</a>', esc_url($product->add_to_cart_url()), esc_attr($product->id), esc_attr($product->get_sku()), esc_attr(isset($quantity) ? $quantity : 1), $product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '', $product->product_type === 'external' || $product->product_type === 'simple' && $product->is_purchasable() || apply_filters('pbosfc_woocommerce_loop_add_to_cart_link_is_alt', false, $product) ? 'alt' : '', esc_attr($product->product_type), esc_html($product->add_to_cart_text())), $product);
    } else {
        /* You can specify quantity and (for variable products) variantions before hitting Add to Cart button :) */
        do_action('woocommerce_before_add_to_cart_form');
        if ($product->product_type == 'simple') {
            ?>

			<form class="cart" method="post" enctype='multipart/form-data'>
				<?php 
            do_action('woocommerce_before_add_to_cart_button');
            if (!$product->is_sold_individually()) {
                woocommerce_quantity_input(array('min_value' => apply_filters('woocommerce_quantity_input_min', 1, $product), 'max_value' => apply_filters('woocommerce_quantity_input_max', $product->backorders_allowed() ? '' : $product->get_stock_quantity(), $product), 'input_value' => isset($_POST['quantity']) ? wc_stock_amount($_POST['quantity']) : 1));
            }
            ?>
<?php

/**
 * The template for displaying archive pages.
 * Learn more: http://codex.wordpress.org/Template_Hierarchy
 */
/**
 * PBO: Shows page title as a breadcrumb when real breadcrumbs are disabled.
 * TODO: sprawdzic jak bedzie wygladac bez Woocommerce
 */
get_header();
if (!pbosfc_get_option('post_breadcrumb')) {
    echo '<nav class="woocommerce-breadcrumb">' . the_archive_title() . '</nav>';
}
?>

<section id="primary" class="content-area">
	<main id="main" class="site-main" role="main">

		<?php 
if (have_posts()) {
    ?>

			<?php 
    get_template_part('loop');
    ?>

		<?php 
} else {
    ?>
/*
 *
 */
// Category/product columns on archives pages
add_filter('loop_shop_columns', function () {
    return pbosfc_get_option('product_columns');
}, 999);
// Products per page
add_filter('loop_shop_per_page', function ($cols) {
    return pbosfc_get_option('products_per_page');
}, 999);
// Related products columns and amount
add_filter('woocommerce_related_products_args', function ($args) {
    $args['columns'] = pbosfc_get_option('product_columns');
    $args['posts_per_page'] = pbosfc_get_option('product_columns');
    return $args;
});
// ...
remove_action('storefront_content_top', 'woocommerce_breadcrumb', 10);
add_action('storefront_content_top', 'pbosfc_woocommerce_breadcrumb', 10);
/*
 * Product(s)
 */
/*
 * Change single product fields presentation order to:
 *  - product name
 *  - short description/excerpt
 *  - rating
 *  - meta
 *  ... (no change)