cart->get_cart_contents_count(), 'beshop'), WC()->cart->get_cart_contents_count() ); ?>
esc_html__('Shop Sidebar', 'beshop'), 'id' => 'shop-sidebar', 'description' => esc_html__('Add shop widgets here.', 'beshop'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'name' => esc_html__('Shop Page Top Widget.', 'beshop'), 'id' => 'top-filter', 'description' => esc_html__('Shop Page products fileter top widget.', 'beshop'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); } add_action('widgets_init', 'beshop_woowidgets_init'); } if (!function_exists('beshop_body_wooclasses')) { function beshop_body_wooclasses($classes) { if (!is_active_sidebar('shop-sidebar') && is_shop()) { $classes[] = 'no-shop-widget'; } if (is_front_page() && is_shop()) { $classes[] = 'befront-shop'; } return $classes; } add_filter('body_class', 'beshop_body_wooclasses'); } /** * Change number or products per row */ add_filter('loop_shop_columns', 'beshop_loop_columns', 999); if (!function_exists('beshop_loop_columns')) { function beshop_loop_columns() { $beshop_shop_column = get_theme_mod('beshop_shop_column', '4'); return $beshop_shop_column; // 4 products per row } } //add new div for product function beshop_before_shop_loop_div() { $beshop_shop_style = get_theme_mod('beshop_shop_style', '1'); echo '
'; } add_action('woocommerce_before_shop_loop_item', 'beshop_before_shop_loop_div', 5); function beshop_after_shop_loop_div() { echo '
'; } add_action('woocommerce_after_shop_loop_item', 'beshop_after_shop_loop_div', 15); // End div for product function beshop_woobody_classes($classes) { // Adds a class of hfeed to non-singular pages. if (is_shop()) { $classes[] = 'be-shop'; } return $classes; } add_filter('body_class', 'beshop_woobody_classes'); function beshop_woocommerce_page_title($page_title) { $beshop_shop_title = get_theme_mod('beshop_shop_title', esc_html__('Shop', 'beshop')); if (is_shop()) { return $beshop_shop_title; } else { return $page_title; } } add_filter('woocommerce_page_title', 'beshop_woocommerce_page_title'); // add filter widget in shop page top function beshop_woocommerce_before_shop_loop() { if (is_active_sidebar('top-filter')) { $beshop_ftwidget_position = get_theme_mod('beshop_ftwidget_position', 'center'); ?>
str_replace($big, '%#%', esc_url(get_pagenum_link($big))), 'format' => '?paged=%#%', 'current' => max(1, get_query_var('paged')), 'total' => $max_num_pages, 'type' => 'array', 'prev_text' => __('«', 'beshop'), 'next_text' => __('»', 'beshop'), )); if (is_array($pages)) { $pagination = ''; echo $pagination; } } /** * Check if there are any products in the WooCommerce store. * * @return bool */ function beshop_has_woocommerce_products() { // Define the query arguments $args = array( 'post_type' => 'product', 'posts_per_page' => 1, 'post_status' => 'publish' ); // Get the products $products = new WP_Query($args); // Check if there are products $has_products = $products->have_posts(); // Reset the post data wp_reset_postdata(); // Check product if ($has_products) { return true; } return false; }