/** * Output WooCommerce content. * * This function is only used in the optional 'woocommerce.php' template. * which people can add to their themes to add basic woocommerce support. * without hooks or modifying core templates. * */ function woocommerce_content() { if (is_singular('product')) { while (have_posts()) { the_post(); wc_get_template_part('content', 'single-product'); } } else { ?> <?php if (apply_filters('woocommerce_show_page_title', true)) { ?> <h1 class="page-title"><?php woocommerce_page_title(); ?> </h1> <?php } ?> <?php do_action('woocommerce_archive_description'); ?> <?php if (have_posts()) { ?> <?php do_action('woocommerce_before_shop_loop'); ?> <?php woocommerce_product_loop_start(); ?> <?php woocommerce_product_subcategories(); ?> <?php while (have_posts()) { the_post(); ?> <?php wc_get_template_part('content', 'product'); ?> <?php } // end of the loop. ?> <?php woocommerce_product_loop_end(); ?> <?php do_action('woocommerce_after_shop_loop'); ?> <?php } elseif (!woocommerce_product_subcategories(array('before' => woocommerce_product_loop_start(false), 'after' => woocommerce_product_loop_end(false)))) { ?> <?php do_action('woocommerce_no_products_found'); ?> <?php } } }
/** * This method is used to display the output of the element. * @return void */ function element() { // Check if this is a normal page or the Shop archive page if (!is_shop()) { global $paged; $wc_query = new WC_Query(); // Get the proper page - this resolves the pagination on static frontpage if (get_query_var('paged')) { $paged = get_query_var('paged'); } elseif (get_query_var('page')) { $paged = get_query_var('page'); } else { $paged = 1; } $ordering = $wc_query->get_catalog_ordering_args(); $queryArgs = array('post_type' => 'product', 'paged' => $paged, 'orderby' => $ordering['orderby'], 'order' => $ordering['order']); if (isset($ordering['meta_key'])) { $queryArgs['meta_key'] = $ordering['meta_key']; } query_posts($queryArgs); } // Change the number of columns add_filter('loop_shop_columns', array(&$this, 'zn_woo_loop_columns'), 999); $sidebar_tweak = $this->opt('num_columns', '4') == 3 ? 'left_sidebar' : ''; echo '<div class="zn_woo_archive_elemenent woocommerce ' . $this->data['uid'] . ' ' . $sidebar_tweak . ' ' . $this->opt('css_class', '') . '">'; ?> <?php if ($this->opt('show_page_title', 'yes') == 'yes') { ?> <h1 class="page-title"><?php woocommerce_page_title(); ?> </h1> <?php } ?> <?php /** * woocommerce_archive_description hook * * @hooked woocommerce_taxonomy_archive_description - 10 * @hooked woocommerce_product_archive_description - 10 */ do_action('woocommerce_archive_description'); ?> <?php if (have_posts()) { ?> <?php /** * woocommerce_before_shop_loop hook * * @hooked woocommerce_result_count - 20 * @hooked woocommerce_catalog_ordering - 30 */ do_action('woocommerce_before_shop_loop'); ?> <?php woocommerce_product_loop_start(); ?> <?php woocommerce_product_subcategories(); ?> <?php while (have_posts()) { the_post(); ?> <?php wc_get_template_part('content', 'product'); ?> <?php } // end of the loop. ?> <?php woocommerce_product_loop_end(); ?> <?php /** * woocommerce_after_shop_loop hook * * @hooked woocommerce_pagination - 10 */ do_action('woocommerce_after_shop_loop'); ?> <?php } elseif (!woocommerce_product_subcategories(array('before' => woocommerce_product_loop_start(false), 'after' => woocommerce_product_loop_end(false)))) { ?> <?php wc_get_template('loop/no-products-found.php'); ?> <?php } ?> <?php wp_reset_postdata(); wp_reset_query(); echo '</div>'; }
<?php woocommerce_catalog_ordering(); ?> </div> <?php } ?> </div> <?php } ?> <?php woocommerce_product_subcategories(array('before' => '<div class="shop-categories row">', 'after' => '</div>')); ?> <?php # end: modified by Arlind Nushi ?> <?php if (have_posts()) { ?> <?php /** * woocommerce_before_shop_loop hook * * @hooked woocommerce_result_count - 20
if (have_posts()) { ?> <section <?php layers_center_column_class(); ?> > <div class="row push-bottom woocommerce-result-count-container"> <?php do_action('woocommerce_before_shop_loop'); ?> </div> <?php // Sub category listing woocommerce_product_subcategories(); ?> <ul class="products row"> <?php while (have_posts()) { the_post(); ?> <?php woocommerce_get_template_part('content', 'product'); ?> <?php } ?> </ul>
function miss_woocommerce_content() { if (is_singular('product')) { while (have_posts()) { the_post(); woocommerce_get_template_part('content', 'single-product'); } } else { ?> <?php if (apply_filters('woocommerce_show_page_title', true)) { ?> <div class="bread-container"> <div class="bread-wrapper"> <div class="blog-title"><?php woocommerce_page_title(); ?> </div> <?php dimox_breadcrumbs(); ?> </div> </div> <?php } ?> <?php do_action('woocommerce_archive_description'); ?> <?php if (have_posts()) { ?> <?php do_action('woocommerce_before_shop_loop'); ?> <?php woocommerce_product_loop_start(); ?> <?php woocommerce_product_subcategories(); ?> <?php while (have_posts()) { the_post(); ?> <?php woocommerce_get_template_part('content', 'product'); ?> <?php } // end of the loop. ?> <?php woocommerce_product_loop_end(); ?> <?php do_action('woocommerce_after_shop_loop'); ?> <?php } elseif (!woocommerce_product_subcategories(array('before' => woocommerce_product_loop_start(false), 'after' => woocommerce_product_loop_end(false)))) { ?> <?php woocommerce_get_template('loop/no-products-found.php'); ?> <?php } } }
</div> <div class="clear"></div> <div class="toolbar bottom"> <?php do_action('woocommerce_after_shop_loop'); ?> <div class="clear"></div> </div> <?php } else { ?> <?php if (!woocommerce_product_subcategories(array('before' => '<ul class="products">', 'after' => '</ul>'))) { ?> <p class="error"><?php _e('No products found which match your selection.', ETHEME_DOMAIN); ?> </p> <?php } ?> <?php } ?>
function anaglyph_woo_get_loop_shop_content() { global $anaglyph_config, $time_post_delay; $layout = 1; $class_content = 'col-md-12'; $layout = esc_attr($anaglyph_config['shop-layout']); if ($layout > 1) { $class_content = 'col-md-9'; } ?> <?php /** * woocommerce_before_main_content hook * * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content) * @hooked woocommerce_breadcrumb - 20 */ do_action('woocommerce_before_main_content'); do_action('woocommerce_archive_description'); ?> <div class="<?php echo $class_content; ?> "> <?php if (have_posts()) { ?> <?php /** * woocommerce_before_shop_loop hook * * @hooked woocommerce_result_count - 20 * @hooked woocommerce_catalog_ordering - 30 */ do_action('woocommerce_before_shop_loop'); ?> <?php woocommerce_product_loop_start(); ?> <?php woocommerce_product_subcategories(); ?> <?php while (have_posts()) { the_post(); ?> <?php wc_get_template_part('content', 'product'); ?> <?php $time_post_delay += 0.2; ?> <?php } // end of the loop. ?> <?php woocommerce_product_loop_end(); ?> <?php /** * woocommerce_after_shop_loop hook * * @hooked woocommerce_pagination - 10 */ do_action('woocommerce_after_shop_loop'); ?> <?php } elseif (!woocommerce_product_subcategories(array('before' => woocommerce_product_loop_start(false), 'after' => woocommerce_product_loop_end(false)))) { ?> <?php wc_get_template('loop/no-products-found.php'); ?> <?php } ?> </div> <!-- end products loop content --> <?php /** * woocommerce_after_main_content hook * * @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content) */ do_action('woocommerce_after_main_content'); }
public static function content() { ?> <?php if (is_singular('product')) { while (have_posts()) { the_post(); wc_get_template_part('content', 'single-product'); } } else { ?> <?php /** * script * {{ */ wp_enqueue_script('vendor-carouFredSel'); ?> <?php if (apply_filters('woocommerce_show_page_title', true)) { ?> <h1 class="page-title"><?php woocommerce_page_title(); ?> </h1> <?php } ?> <?php do_action('woocommerce_archive_description'); ?> <?php if (have_posts()) { ?> <?php $current_view_mode = dh_get_theme_option('dh_woocommerce_view_mode', 'grid'); if (isset($_GET['mode']) && in_array($_GET['mode'], array('grid', 'list'))) { $current_view_mode = $_GET['mode']; } $grid_mode_href = $current_view_mode == 'list' ? ' href="' . esc_url(add_query_arg('mode', 'grid')) . '"' : ''; $list_mode_href = $current_view_mode == 'grid' ? ' href="' . esc_url(add_query_arg('mode', 'list')) . '"' : ''; ?> <div class="shop-toolbar"> <div class="view-mode"> <a class="grid-mode<?php echo $current_view_mode == 'grid' ? ' active' : ''; ?> " title="<?php esc_attr_e('Grid', DH_DOMAIN); ?> " <?php echo $grid_mode_href; ?> ><i class="fa fa-th"></i></a> <a class="list-mode<?php echo $current_view_mode == 'list' ? ' active' : ''; ?> " title="<?php esc_attr_e('List', DH_DOMAIN); ?> " <?php echo $list_mode_href; ?> ><i class="fa fa-th-list"></i></a> </div> <?php do_action('woocommerce_before_shop_loop'); ?> <nav class="woocommerce-pagination"> <?php dh_paginate_links_short(); ?> </nav> </div> <div class="shop-loop <?php echo esc_attr($current_view_mode); ?> "> <?php woocommerce_product_loop_start(); ?> <?php woocommerce_product_subcategories(); ?> <?php while (have_posts()) { the_post(); ?> <?php wc_get_template_part('content', 'product'); ?> <?php } // end of the loop. ?> <?php woocommerce_product_loop_end(); ?> </div> <?php do_action('woocommerce_after_shop_loop'); ?> <?php } elseif (!woocommerce_product_subcategories(array('before' => woocommerce_product_loop_start(false), 'after' => woocommerce_product_loop_end(false)))) { ?> <?php wc_get_template('loop/no-products-found.php'); ?> <?php } } }
$_old_woocommerce_loop = $woocommerce_loop; ?> <?php //$woocommerce_loop = $_old_woocommerce_loop; if (absint($wd_data['wd_prod_cat_column']) > 0) { $woocommerce_loop['columns'] = absint($wd_data['wd_prod_cat_column']); } ?> <ul class="archive-product-subcategories"> <?php ob_start(); ?> <?php $show_sub_cat = woocommerce_product_subcategories(); ?> <?php echo $product_subcategories_html = ob_get_clean(); ?> </ul> <?php if (have_posts()) { ?> <div class="wd_meta_loop"> <?php /** * woocommerce_before_shop_loop hook
/** * Shortcode AJAX Respond */ public static function prdctfltr_respond() { global $prdctfltr_global; $shortcode_params = explode('|', $_POST['pf_shortcode']); $preset = $shortcode_params[0] !== 'false' ? $shortcode_params[0] : ''; $columns = $shortcode_params[1] !== 'false' ? $shortcode_params[1] : 4; $rows = $shortcode_params[2] !== 'false' ? $shortcode_params[2] : 4; $pagination = $shortcode_params[3] !== 'false' ? $shortcode_params[3] : ''; $no_products = $shortcode_params[4] !== 'false' ? $shortcode_params[4] : ''; $show_products = $shortcode_params[5] !== 'false' ? $shortcode_params[5] : ''; $use_filter = $shortcode_params[6] !== 'false' ? $shortcode_params[6] : ''; $action = $shortcode_params[7] !== 'false' ? $shortcode_params[7] : ''; $bot_margin = $shortcode_params[8] !== 'false' ? $shortcode_params[8] : ''; $class = $shortcode_params[9] !== 'false' ? $shortcode_params[9] : ''; $shortcode_id = $shortcode_params[10] !== 'false' ? $shortcode_params[10] : ''; $disable_overrides = $shortcode_params[11] !== 'false' ? $shortcode_params[11] : ''; $show_categories = $shortcode_params[12] !== 'false' ? $shortcode_params[12] : ''; $cat_columns = $shortcode_params[13] !== 'false' ? $shortcode_params[13] : ''; $res_paged = isset($_POST['pf_paged']) ? $_POST['pf_paged'] : $_POST['pf_page']; parse_str($_POST['pf_query'], $qargs); $qargs = array_merge($qargs, array('post_type' => 'product', 'post_status' => 'publish')); $ajax_query = http_build_query($qargs); $current_page = WC_Prdctfltr::prdctfltr_get_between($ajax_query, 'paged=', '&'); $page = $res_paged; $args = str_replace('paged=' . $current_page . '&', 'paged=' . $page . '&', $ajax_query); if ($no_products == 'yes') { $use_filter = 'no'; $pagination = 'no'; $orderby = 'rand'; } $add_ajax = ' data-query="' . $args . '" data-page="' . $res_paged . '" data-shortcode="' . $_POST['pf_shortcode'] . '"'; $bot_margin = (int) $bot_margin; $margin = " style='margin-bottom:" . $bot_margin . "px'"; if (isset($_POST['pf_filters'])) { $curr_filters = $_POST['pf_filters']; } else { $curr_filters = array(); } $filter_args = ''; foreach ($curr_filters as $k => $v) { if (strpos($v, ',')) { $new_v = str_replace(',', '%2C', $v); } else { if (strpos($v, '+')) { $new_v = str_replace('+', '%2B', $v); } else { $new_v = $v; } } $filter_args .= '&' . $k . '=' . $new_v; } $prdctfltr_global['ajax_query'] = $args; $args = $args . $filter_args . '&prdctfltr=active'; $prdctfltr_global['ajax_paged'] = $res_paged; $prdctfltr_global['active_filters'] = $curr_filters; if ($action !== '') { $prdctfltr_global['action'] = $action; } if ($preset !== '') { $prdctfltr_global['preset'] = $preset; } if ($disable_overrides !== '') { $prdctfltr_global['disable_overrides'] = $disable_overrides; } $out = ''; global $woocommerce, $woocommerce_loop, $wp_the_query, $wp_query; $woocommerce_loop['columns'] = apply_filters('loop_shop_columns', $columns); $prdctfltr_global['ajax'] = true; $prdctfltr_global['sc_ajax'] = $_POST['pf_mode'] == 'no' ? 'no' : null; $products = new WP_Query($args); $products->is_search = false; $wp_query = $products; $wp_the_query = $products; ob_start(); if ($use_filter == 'yes') { include WC_Prdctfltr::$dir . 'woocommerce/loop/product-filter.php'; } if ($products->have_posts()) { if ($show_products == 'yes') { woocommerce_product_loop_start(); if (isset($prdctfltr_global['categories_active']) && $prdctfltr_global['categories_active'] === true) { if ($show_categories == 'archive') { if (isset($cat_columns)) { $woocommerce_loop['columns'] = $cat_columns; } woocommerce_product_subcategories(); } else { if ($show_categories == 'yes') { if (isset($cat_columns)) { $woocommerce_loop['columns'] = $cat_columns; } self::get_categories(); } } } while ($products->have_posts()) { $products->the_post(); if (isset($columns)) { $woocommerce_loop['columns'] = $columns; } wc_get_template_part('content', 'product'); } woocommerce_product_loop_end(); } else { $pagination = 'no'; } } else { include WC_Prdctfltr::$dir . 'woocommerce/loop/product-filter-no-products-found.php'; } $prdctfltr_global['ajax'] = null; $shortcode = str_replace('type-product', 'product type-product', ob_get_clean()); $out .= '<div' . ($shortcode_id != '' ? ' id="' . $shortcode_id . '"' : '') . ' class="prdctfltr_sc_products woocommerce prdctfltr_ajax' . ($class != '' ? ' ' . $class . '' : '') . '"' . $margin . $add_ajax . '>'; $out .= do_shortcode($shortcode); if ($pagination == 'yes') { $wp_query = $products; ob_start(); add_filter('woocommerce_pagination_args', 'WC_Prdctfltr::prdctfltr_pagination_filter', 999, 1); wc_get_template('loop/pagination.php'); remove_filter('woocommerce_pagination_args', 'WC_Prdctfltr::prdctfltr_pagination_filter'); $pagination = ob_get_clean(); $out .= $pagination; } if ($_POST['pf_widget'] == 'yes') { if (isset($_POST['pf_widget_title'])) { $curr_title = explode('%%%', $_POST['pf_widget_title']); } ob_start(); the_widget('prdctfltr', 'preset=' . $_POST['pf_preset'] . '&template=' . $_POST['pf_template'], array('before_title' => stripslashes($curr_title[0]), 'after_title' => stripslashes($curr_title[1]))); $out .= ob_get_clean(); } $out .= '</div>'; die($out); exit; }
/** * Output WooCommerce content - disbled. * * */ function woocommerce_content_modified() { if (is_singular('product')) { while (have_posts()) { the_post(); wc_get_template_part('content', 'single-product'); } } else { ?> <?php if (apply_filters('woocommerce_show_page_title', true)) { ?> <h1 class="page-title"><?php woocommerce_page_title(); ?> </h1> <?php } ?> <?php do_action('woocommerce_archive_description'); ?> <?php if (have_posts()) { ?> <?php do_action('woocommerce_before_shop_loop'); ?> <?php woocommerce_product_loop_start(); ?> <?php woocommerce_product_subcategories(); ?> <?php while (have_posts()) { the_post(); ?> <?php wc_get_template_part('content', 'product'); ?> <?php } // end of the loop. ?> <?php woocommerce_product_loop_end(); ?> <?php do_action('woocommerce_after_shop_loop'); if (function_exists('woocommerce_pagination')) { woocommerce_pagination(); } ?> <?php $cat_extra_content = get_option("product_cat_" . $curnt_cat_id . "_category_extra_content"); $extra_content = explode("<!--more-->", $cat_extra_content); if (!empty($extra_content[1])) { echo "<article>" . $extra_content[0] . " <a class='more-link'>Read More</a><div class='more-content'>" . $extra_content[1] . "</div></article>"; } else { echo "<article>" . $extra_content[0] . "</article>"; } ?> <?php } elseif (!woocommerce_product_subcategories(array('before' => woocommerce_product_loop_start(false), 'after' => woocommerce_product_loop_end(false)))) { ?> <?php wc_get_template('loop/no-products-found.php'); ?> <?php } } }
function my_account() { global $product; $funds = $this->get_account_funds(); $args = array('post_type' => 'product', 'meta_query' => array(array('key' => '_is_deposit', 'value' => 'yes'))); query_posts($args); echo '<h2>' . __('Account Funds', 'wc_account_funds') . '</h2>'; echo '<p>' . sprintf(__('You currently have <b>%s</b> in your account.', 'wc_account_funds'), $funds) . '</p>'; if (have_posts()) { do_action('woocommerce_before_shop_loop'); ?> <ul class="products"> <?php woocommerce_product_subcategories(); ?> <?php while (have_posts()) { the_post(); ?> <?php woocommerce_get_template_part('content', 'product'); ?> <?php } // end of the loop. // Reset Post Data wp_reset_query(); ?> </ul> <?php do_action('woocommerce_after_shop_loop'); } $this->my_account_orders(); }
public static function get_products($products) { global $prdctfltr_global, $woocommerce_loop; $opt = self::$settings['opt']; $offset = intval($opt['pf_offset']); //$id = isset( $prdctfltr_global['unique_id'] ) ? $prdctfltr_global['unique_id'] : $prdctfltr_global['true_id']; if (isset($prdctfltr_global['unique_id']) && isset($prdctfltr_global['pagefilters'][$prdctfltr_global['unique_id']]['atts'])) { extract($prdctfltr_global['pagefilters'][$prdctfltr_global['unique_id']]['atts']); } else { $show_categories = 'archive'; $cat_columns = ''; $show_products = 'yes'; } if ($show_products == 'no') { return; } ob_start(); self::$settings['instance'] = $products; if ($products->have_posts()) { woocommerce_product_loop_start(); if (isset($prdctfltr_global['categories_active']) && $prdctfltr_global['categories_active'] === true) { if ($show_categories == 'archive') { if (isset($cat_columns)) { $woocommerce_loop['columns'] = $cat_columns; } woocommerce_product_subcategories(); } else { if ($show_categories == 'yes') { if (isset($cat_columns)) { $woocommerce_loop['columns'] = $cat_columns; } self::get_categories(); } } } $woocommerce_loop['columns'] = self::$settings['columns']; if ($offset > 0) { $curr_offset = $offset / $woocommerce_loop['columns']; $decimal = $curr_offset - (int) $curr_offset; if ($decimal > 0) { $woocommerce_loop['loop'] = $decimal * $woocommerce_loop['columns']; } else { $woocommerce_loop['loop'] = 0; } } while ($products->have_posts()) { $products->the_post(); wc_get_template_part('content', 'product'); } woocommerce_product_loop_end(); } else { include WC_Prdctfltr::$dir . 'woocommerce/loop/no-products-found.php'; } return ob_get_clean(); }
function woocommerce_default_index_loop() { if (have_posts()) { ?> <?php if (!function_exists('the_ddlayout')) { do_action('woocommerce_before_shop_loop'); } ?> <?php woocommerce_product_loop_start(); ?> <?php woocommerce_product_subcategories(); ?> <?php while (have_posts()) { the_post(); ?> <?php wc_get_template_part('content', 'product'); ?> <?php } // end of the loop. ?> <?php woocommerce_product_loop_end(); ?> <?php /** * woocommerce_after_shop_loop hook * * @hooked woocommerce_pagination - 10 */ if (!function_exists('the_ddlayout')) { do_action('woocommerce_after_shop_loop'); } ?> <?php } elseif (!woocommerce_product_subcategories(array('before' => woocommerce_product_loop_start(false), 'after' => woocommerce_product_loop_end(false)))) { ?> <?php wc_get_template('loop/no-products-found.php'); ?> <?php } if (!function_exists('the_ddlayout')) { /** * woocommerce_after_main_content hook * * @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content) */ do_action('woocommerce_after_main_content'); } }
/** * Output WooCommerce content. * * This function is only used in the optional 'woocommerce.php' template * which people can add to their themes to add basic woocommerce support * without using hooks or modifying core templates. * * @access public * @return void * * WM: OVERRIDE * Just removed H1 tag */ function woocommerce_content() { if ( is_singular( 'product' ) ) { while ( have_posts() ) : the_post(); woocommerce_get_template_part( 'content', 'single-product' ); endwhile; } else { //Just removed H1 tag do_action( 'woocommerce_archive_description' ); ?> <?php if ( have_posts() ) : ?> <?php do_action('woocommerce_before_shop_loop'); ?> <?php woocommerce_product_loop_start(); ?> <?php woocommerce_product_subcategories(); ?> <?php while ( have_posts() ) : the_post(); ?> <?php woocommerce_get_template_part( 'content', 'product' ); ?> <?php endwhile; // end of the loop. ?> <?php woocommerce_product_loop_end(); ?> <?php do_action('woocommerce_after_shop_loop'); ?> <?php elseif ( ! woocommerce_product_subcategories( array( 'before' => woocommerce_product_loop_start( false ), 'after' => woocommerce_product_loop_end( false ) ) ) ) : ?> <?php woocommerce_get_template( 'loop/no-products-found.php' ); ?> <?php endif; } } // /woocommerce_content
/** Template pages ******************************************************* */ if (!function_exists('woocommerce_content')) { /** * Output WooCommerce content. * * This function is only used in the optional 'woocommerce.php' template * which people can add to their themes to add basic woocommerce support * without hooks or modifying core templates. * * @access public * @return void */ function woocommerce_content() { ?> <div class="body-content-top"> <div class="body-content"> <?php if (is_singular('product')) { remove_action('woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10); add_action('woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 30); remove_action('woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20); remove_action('woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15); add_action('woocommerce_after_single_product', 'woocommerce_upsell_display', 40); do_action('woocommerce_before_shop_loop'); while (have_posts()) { the_post(); woocommerce_get_template_part('content', 'single-product'); } } else { ?> <?php if (apply_filters('woocommerce_show_page_title', true)) { ?> <h1 class="page-title"><?php woocommerce_page_title(); ?> </h1> <?php } ?> <?php do_action('woocommerce_archive_description'); ?> <?php
/** * This function creates the html code necessary for a woocommerce shop section. It uses the woocommerce shop loop to do that * * @param array $element is an array with all the data necessary for creating the html code (it contains the element data and the saved values for the element) * @return string $output the string returned contains the html code generated within the method */ function shop($element) { $output = ""; //check if the plugin is enabled if (!avia_woocommerce_enabled()) { $url = network_site_url('wp-admin/plugin-install.php?tab=search&type=term&s=WooCommerce&plugin-search-input=Search+Plugins'); $output = "<p><strong>You need to install and activate the <a href='{$url}'>WooCommerce Shop Plugin</a> to display Products</strong></p>"; return $output; } extract($element['saved_value'][0]); global $avia_config, $more, $woocommerce_loop; if ($shop_columns == 5 && strpos($avia_config['layout'], 'dual') !== false) { $shop_columns = 4; } if ($shop_text == 'yes') { $avia_config['shop_overview_excerpt'] = 'active'; } $woocommerce_loop['columns'] = $avia_config['shop_overview_column'] = $shop_columns; $order = get_option('woocommerce_default_catalog_orderby'); if (!$order) { $order = "menu_order"; } $avia_config['new_query'] = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, "paged" => get_query_var('paged'), 'posts_per_page' => $shop_item_count, 'orderby' => $order, 'order' => 'desc', 'meta_query' => array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN'))); if (empty($shop_cats_dynamic) || $shop_cats_dynamic == 'null') { $avia_config['new_query']['post_type'] = "product"; } else { $avia_config['new_query']['tax_query'] = array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => explode(',', $shop_cats_dynamic), 'operator' => 'IN')); } query_posts($avia_config['new_query']); ob_start(); if (have_posts()) { do_action('woocommerce_before_shop_loop'); echo '<ul class="products">'; woocommerce_product_subcategories(); while (have_posts()) { the_post(); woocommerce_get_template_part('content', 'product'); } // end of the loop. echo '</ul>'; do_action('woocommerce_after_shop_loop'); } else { if (!woocommerce_product_subcategories(array('before' => '<ul class="products">', 'after' => '</ul>'))) { echo "<p>" . __('No products found which match your selection.', 'woocommerce') . "</p>"; } } echo '<div class="clear"></div>'; $products = ob_get_clean(); $output .= "<div class='container_wrap " . $avia_config['layout'] . " template-shop shop_columns_" . $avia_config['shop_overview_column'] . "'>"; $output .= "<div class='template-shop content shop_slider_{$shop_slider}' data-interval='{$shop_autorotate}'>"; $output .= $products; if ($shop_pagination == 'yes') { $output .= avia_pagination(); } $output .= "</div>"; $output .= "</div>"; wp_reset_query(); return $output; }
?> <?php if ( have_posts() ) : ?> <?php do_action('woocommerce_before_shop_loop'); ?> <div class="products"> <?php woocommerce_product_subcategories(); ?> <?php while ( have_posts() ) : the_post(); ?> <?php woocommerce_get_template_part( 'content', 'product' ); ?> <?php endwhile; // end of the loop. ?> </div> <?php do_action('woocommerce_after_shop_loop'); ?> <?php else : ?> <?php if ( ! woocommerce_product_subcategories( array( 'before' => '<div class="products">', 'after' => '</div>' ) ) ) : ?> <p><?php _e( 'No products found which match your selection.', 'woocommerce' ); ?></p> <?php endif; ?> <?php endif; ?> <div class="clear"></div>
public function html() { global $woocommerce, $woocommerce_loop; $output = ""; global $avia_config; $output = ""; avia_post_slider::$slide++; extract($this->atts); $extraClass = 'first'; $grid = 'one_third'; $image_size = 'portfolio'; $post_loop_count = 1; $loop_counter = 1; $autoplay = $autoplay == "no" ? false : true; $total = $columns % 2 ? "odd" : "even"; $woocommerce_loop['columns'] = $columns; switch ($columns) { case "1": $grid = 'av_fullwidth'; $image_size = 'large'; break; case "2": $grid = 'av_one_half'; break; case "3": $grid = 'av_one_third'; break; case "4": $grid = 'av_one_fourth'; $image_size = 'portfolio_small'; break; case "5": $grid = 'av_one_fifth'; $image_size = 'portfolio_small'; break; } $data = AviaHelper::create_data_string(array('autoplay' => $autoplay, 'interval' => $interval, 'animation' => $animation, 'hoverpause' => 1)); ob_start(); if (have_posts()) { echo "<div {$data} class='template-shop avia-content-slider avia-content-{$type}-active avia-content-slider" . avia_post_slider::$slide . " avia-content-slider-{$total} {$class} shop_columns_{$columns}' >"; if ($sort == "dropdown") { avia_woocommerce_frontend_search_params(); } echo "<div class='avia-content-slider-inner'>"; if ($type == 'grid') { echo '<ul class="products">'; } while (have_posts()) { the_post(); if ($loop_counter == 1 && $type == 'slider') { echo '<ul class="products slide-entry-wrap">'; } woocommerce_get_template_part('content', 'product'); $loop_counter++; $post_loop_count++; if ($loop_counter > $columns) { $loop_counter = 1; } if ($loop_counter == 1 && $type == 'slider') { echo '</ul>'; } } // end of the loop. if ($loop_counter != 1 || $type == 'grid') { echo '</ul>'; } echo "</div>"; if ($post_loop_count - 1 > $columns && $type == 'slider') { echo $this->slide_navigation_arrows(); } echo "</div>"; } else { if (!woocommerce_product_subcategories(array('before' => '<ul class="products">', 'after' => '</ul>'))) { echo "<p>" . __('No products found which match your selection.', 'woocommerce') . "</p>"; } } echo '<div class="clear"></div>'; $products = ob_get_clean(); $output .= $products; if ($paginate == "yes" && ($avia_pagination = avia_pagination('', 'nav'))) { $output .= "<div class='pagination-wrap pagination-slider'>{$avia_pagination}</div>"; } wp_reset_query(); return $output; }
/** * Widget ajax listener */ function tb_listener() { global $wp_query, $wp_rewrite; add_filter('post_class', 'add_product_class'); add_filter('woocommerce_pagination_args', 'pagination_args'); $args = apply_filters('tb_listener_wp_query_args', array()); if (!isset($args['post__in'])) { $args['post__in'] = array(); } $woocommerce_hide_out_of_stock_items = BeRocket_AAPF_Widget::woocommerce_hide_out_of_stock_items(); if ($woocommerce_hide_out_of_stock_items == 'yes') { $args['post__in'] = BeRocket_AAPF::remove_out_of_stock($args['post__in']); } $args['post__in'] = BeRocket_AAPF::remove_hidden($args['post__in']); $args['post__in'] = BeRocket_AAPF::limits_filter($args['post__in']); $args['post__in'] = BeRocket_AAPF::price_filter($args['post__in']); $args['post_status'] = 'publish'; $args['post_type'] = 'product'; $args['post__in'] = BeRocket_AAPF::price_filter($args['post__in']); $default_posts_per_page = get_option('posts_per_page'); $args['posts_per_page'] = apply_filters('loop_shop_per_page', $default_posts_per_page); unset($default_posts_per_page); $wp_query = new WP_Query($args); // here we get max products to know if current page is not too big if ($wp_rewrite->using_permalinks() and preg_match("~/page/([0-9]+)~", $_POST['location'], $mathces) or preg_match("~paged?=([0-9]+)~", $_POST['location'], $mathces)) { $args['paged'] = min($mathces[1], $wp_query->max_num_pages); $wp_query = new WP_Query($args); } unset($args); ob_start(); if ($wp_query->have_posts()) { do_action('woocommerce_before_shop_loop'); woocommerce_product_loop_start(); woocommerce_product_subcategories(); while (have_posts()) { the_post(); wc_get_template_part('content', 'product'); } woocommerce_product_loop_end(); do_action('woocommerce_after_shop_loop'); wp_reset_postdata(); $_RESPONSE['products'] = ob_get_contents(); } else { wc_get_template('loop/no-products-found.php'); $_RESPONSE['no_products'] = ob_get_contents(); } ob_end_clean(); echo json_encode($_RESPONSE); die; }
function bs_shop_loop($product = null, $columns = null) { $template = 'bs-content-product'; $woocommerce_loop = array('loop' => 0, 'columns' => $columns ? $columns : get_option('number_of_columns', 4)); /* double check */ if ($woocommerce_loop['columns'] != 31 && ($woocommerce_loop['columns'] > 6 || in_array($woocommerce_loop['columns'], array(5, 7)))) { return; } // Increase loop count $woocommerce_loop['loop']++; ob_start(); woocommerce_product_subcategories(array('before' => '<div class="clearfix"></div><div class="subcategories"><div class="row">', 'after' => '</div></div>')); $subcategories = ob_get_contents(); ob_end_clean(); $classes = $this->get_grid_classes($woocommerce_loop); echo preg_replace(array('/<li[^>]*>/', '/<\\/li>/'), array('<div class="' . $classes . '">', '</div>'), $subcategories); if ($product) { ?> <div class="clearfix"></div><div class="products"><div class="row"><?php while ($product->have_posts()) { $product->the_post(); $this->bs_product_loop($woocommerce_loop, $classes, $template); } } else { ?> <div class="clearfix"></div><div class="products"><div class="row"><?php while (have_posts()) { the_post(); $this->bs_product_loop($woocommerce_loop, $classes); } } if ($woocommerce_loop['columns'] == 31) { $woocommerce_loop['columns'] = 3; } if (0 != ($woocommerce_loop['loop'] - 1) % $woocommerce_loop['columns']) { ?> <div class="<?php echo $classes; ?> "></div><?php while (0 != $woocommerce_loop['loop'] % $woocommerce_loop['columns']) { $woocommerce_loop['loop']++; ?> <div class="<?php echo $classes; ?> "></div><?php } } ?> </div></div><?php }
public static function content($is_ajax = false) { global $wp_query; ?> <?php if (is_singular('product')) { while (have_posts()) { the_post(); wc_get_template_part('content', 'single-product'); } } else { ?> <?php /** * script * {{ */ if (!$is_ajax) { wp_enqueue_script('vendor-carouFredSel'); } ?> <?php if (apply_filters('woocommerce_show_page_title', true)) { ?> <h1 class="page-title"><?php woocommerce_page_title(); ?> </h1> <?php } ?> <?php do_action('woocommerce_archive_description'); ?> <?php $current_view_mode = dh_get_theme_option('dh_woocommerce_view_mode', 'grid'); if (isset($_GET['mode']) && in_array($_GET['mode'], array('grid', 'list'))) { $current_view_mode = $_GET['mode']; } $grid_mode_href = $current_view_mode == 'list' ? ' href="' . esc_url(add_query_arg('mode', 'grid')) . '"' : ''; $list_mode_href = $current_view_mode == 'grid' ? ' href="' . esc_url(add_query_arg('mode', 'list')) . '"' : ''; $dh_ul_product_class = ''; $woo_products_pagination = dh_get_theme_option('woo-products-pagination', 'page_num'); if ($woo_products_pagination === 'infinite_scroll') { $dh_ul_product_class = 'infinite-scroll-wrap'; } elseif ($woo_products_pagination === 'loadmore') { $dh_ul_product_class = 'loadmore-wrap'; } ?> <div class="shop-toolbar"> <?php if (!dh_get_theme_option('woo-shop-filter', 0)) { ?> <?php woocommerce_catalog_ordering(); ?> <?php } ?> <div class="view-mode"> <a class="grid-mode<?php echo $current_view_mode == 'grid' ? ' active' : ''; ?> " title="<?php esc_attr_e('Grid', 'sitesao'); ?> " <?php echo $grid_mode_href; ?> ><i class="fa fa-th"></i></a> <a class="list-mode<?php echo $current_view_mode == 'list' ? ' active' : ''; ?> " title="<?php esc_attr_e('List', 'sitesao'); ?> " <?php echo $list_mode_href; ?> ><i class="fa fa-list"></i></a> </div> <?php if (dh_get_theme_option('woo-shop-filter', 0)) { ?> <div class="filter-toggle-button"> <a class="filter" title="<?php esc_attr_e('Filter', 'sitesao'); ?> " href="#"><i class="fa fa-filter"></i> <?php esc_html_e('Filter', 'sitesao'); ?> </a> </div> <?php } ?> </div> <?php if (dh_get_theme_option('woo-shop-filter', 0) && is_active_sidebar('sidebar-shop-filter')) { ?> <div class="sidebar-shop-filter" data-toggle="shop-filter-ajax"> <?php $sidebars_widgets = wp_get_sidebars_widgets(); $count = count((array) $sidebars_widgets['sidebar-shop-filter']); $count = absint($count); ?> <div class="sidebar-shop-filter-wrap sidebar-shop-filter-<?php echo esc_attr($count); ?> "> <?php dynamic_sidebar('sidebar-shop-filter'); ?> </div> </div> <?php } ?> <div class="shop-loop-wrap <?php echo $dh_ul_product_class; ?> "> <div class="filter-ajax-loading"> <div class="fade-loading"><i></i><i></i><i></i><i></i></div> </div> <div class="shop-loop <?php echo esc_attr($current_view_mode); ?> " > <?php if (is_search() && is_post_type_archive('product')) { ?> <h3 class="woocommerce-search-text"><?php dh_page_title(); ?> </h3> <?php } ?> <?php if (have_posts()) { ?> <?php woocommerce_product_loop_start(); ?> <?php woocommerce_product_subcategories(); ?> <?php while (have_posts()) { the_post(); ?> <?php wc_get_template_part('content', 'product'); ?> <?php } // end of the loop. ?> <?php woocommerce_product_loop_end(); ?> <?php do_action('woocommerce_after_shop_loop'); ?> <?php } elseif (!woocommerce_product_subcategories(array('before' => woocommerce_product_loop_start(false), 'after' => woocommerce_product_loop_end(false)))) { ?> <?php wc_get_template('loop/no-products-found.php'); ?> <?php } ?> </div> </div> <?php } }
function woocommerce_content() { if (is_singular('product')) { while (have_posts()) { the_post(); woocommerce_get_template_part('content', 'single-product'); } } else { ?> <h1 class="page-title"> <?php if (is_search()) { ?> <?php printf(__('Search Results: “%s”', 'woocommerce'), get_search_query()); ?> <?php } elseif (is_tax()) { ?> <?php echo single_term_title("", false); ?> <?php } else { ?> <?php $shop_page = get_post(woocommerce_get_page_id('shop')); echo apply_filters('the_title', ($shop_page_title = get_option('woocommerce_shop_page_title')) ? $shop_page_title : $shop_page->post_title); ?> <?php } ?> <?php if (get_query_var('paged')) { ?> <?php printf(__(' – Page %s', 'woocommerce'), get_query_var('paged')); ?> <?php } ?> </h1> <?php if (is_tax()) { ?> <?php echo '<div class="term-description">' . wpautop(wptexturize(term_description())) . '</div>'; ?> <?php } elseif (!is_search() && !empty($shop_page) && is_object($shop_page)) { ?> <?php echo '<div class="page-description">' . apply_filters('the_content', $shop_page->post_content) . '</div>'; ?> <?php } ?> <?php if (have_posts()) { ?> <?php do_action('woocommerce_before_shop_loop'); ?> <ul class="products"> <?php woocommerce_product_subcategories(); ?> <?php while (have_posts()) { the_post(); ?> <?php woocommerce_get_template_part('content', 'product'); ?> <?php } // end of the loop. ?> </ul> <?php do_action('woocommerce_after_shop_loop'); ?> <?php } else { ?> <?php if (!woocommerce_product_subcategories(array('before' => '<ul class="products">', 'after' => '</ul>'))) { ?> <p><?php _e('No products found which match your selection.', 'woocommerce'); ?> </p> <?php } ?> <?php } ?> <div class="clear"></div> <?php do_action('woocommerce_pagination'); } }
/** * Widget ajax listener */ public static function listener() { global $wp_query, $wp_rewrite; $br_options = apply_filters('berocket_aapf_listener_br_options', get_option('br_filters_options')); add_filter('post_class', array(__CLASS__, 'add_product_class')); add_filter('woocommerce_pagination_args', array(__CLASS__, 'pagination_args')); $args = apply_filters('berocket_aapf_listener_wp_query_args', array()); $args['post__in'] = BeRocket_AAPF::limits_filter(array()); $args['post__in'] = BeRocket_AAPF::price_filter($args['post__in']); $args['post_status'] = 'publish'; $args['post_type'] = 'product'; $args['post__in'] = BeRocket_AAPF::price_filter($args['post__in']); $wp_query = new WP_Query($args); // here we get max products to know if current page is not too big if ($wp_rewrite->using_permalinks() and preg_match("~/page/([0-9]+)~", $_POST['location'], $mathces) or preg_match("~paged?=([0-9]+)~", $_POST['location'], $mathces)) { $args['paged'] = min($mathces[1], $wp_query->max_num_pages); $wp_query = new WP_Query($args); } ob_start(); if ($wp_query->have_posts()) { do_action('woocommerce_before_shop_loop'); woocommerce_product_loop_start(); woocommerce_product_subcategories(); while (have_posts()) { the_post(); wc_get_template_part('content', 'product'); } woocommerce_product_loop_end(); do_action('woocommerce_after_shop_loop'); wp_reset_postdata(); $_RESPONSE['products'] = ob_get_contents(); } else { echo apply_filters('berocket_aapf_listener_no_products_message', "<div class='no-products" . ($br_options['no_products_class'] ? ' ' . $br_options['no_products_class'] : '') . "'>" . $br_options['no_products_message'] . "</div>"); $_RESPONSE['no_products'] = ob_get_contents(); } ob_end_clean(); echo json_encode($_RESPONSE); die; }
<?php woocommerce_product_loop_end(); ?> <?php /** * woocommerce_after_shop_loop hook * * @hooked woocommerce_pagination - 10 */ do_action('woocommerce_after_shop_loop'); ?> </div> <?php } elseif (!woocommerce_product_subcategories(array('before' => woocommerce_product_loop_start(false), 'after' => woocommerce_product_loop_end(false)))) { ?> <?php wc_get_template('loop/no-products-found.php'); ?> <?php } ?> <?php /** * woocommerce_after_main_content hook * * @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)
/** * Displays shop items for archives (taxonomy and main shop page) * * Only loaded if WooC 1.6.0+ is in use. * * Uses WooCommerce structure and contains all existing WooCommerce hooks * * Code based on WooCommerce 2.1.12 templates/archive-product.php * * * @since 0.9.4 * @updated 0.9.8 */ function genesiswooc_content_product() { ?> <?php /** * woocommerce_before_main_content hook * * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content) * @hooked woocommerce_breadcrumb - 20 */ do_action('woocommerce_before_main_content'); ?> <?php if (apply_filters('woocommerce_show_page_title', true)) { ?> <h1 class="page-title"><?php woocommerce_page_title(); ?> </h1> <?php } ?> <?php do_action('woocommerce_archive_description'); ?> <?php if (have_posts()) { ?> <?php /** * woocommerce_before_shop_loop hook * * @hooked woocommerce_result_count - 20 * @hooked woocommerce_catalog_ordering - 30 */ do_action('woocommerce_before_shop_loop'); ?> <?php woocommerce_product_loop_start(); ?> <?php woocommerce_product_subcategories(); ?> <?php while (have_posts()) { the_post(); ?> <?php wc_get_template_part('content', 'product'); ?> <?php } // end of the loop. ?> <?php woocommerce_product_loop_end(); ?> <?php /** * woocommerce_after_shop_loop hook * * @hooked woocommerce_pagination - 10 */ do_action('woocommerce_after_shop_loop'); ?> <?php } elseif (!woocommerce_product_subcategories(array('before' => woocommerce_product_loop_start(false), 'after' => woocommerce_product_loop_end(false)))) { ?> <?php wc_get_template('loop/no-products-found.php'); ?> <?php } ?> <?php /** * woocommerce_after_main_content hook * * @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content) */ do_action('woocommerce_after_main_content'); ?> <?php }