• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP woocommerce_get_product_ids_on_sale函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中woocommerce_get_product_ids_on_sale函数的典型用法代码示例。如果您正苦于以下问题:PHP woocommerce_get_product_ids_on_sale函数的具体用法?PHP woocommerce_get_product_ids_on_sale怎么用?PHP woocommerce_get_product_ids_on_sale使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了woocommerce_get_product_ids_on_sale函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: shortcode_onsale_product_carousel

 function shortcode_onsale_product_carousel($atts, $content = null)
 {
     extract(shortcode_atts(array('title' => 'On Sale', 'counts' => '16', 'order' => 'DESC', 'orderby' => 'date', 'auto' => 'false', 'speed' => '800', 'pause' => '5000', 'move_slides' => '4'), $atts));
     global $woocommerce;
     $id = twoot_get_frontend_func('rand_num', 5);
     // Get products on sale
     $product_ids_on_sale = woocommerce_get_product_ids_on_sale();
     $product_ids_on_sale[] = 0;
     $meta_query = $woocommerce->query->get_meta_query();
     $query_args = array('posts_per_page' => $counts, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'orderby' => $orderby, 'order' => $order, 'meta_query' => $meta_query, 'post__in' => $product_ids_on_sale);
     $products = new WP_Query($query_args);
     if ($products->have_posts()) {
         $html = '<div class="the-carousel-list the-product-list">';
         $html .= '<h5 class="carousel-title">' . $title . '</h5>';
         $html .= '<ul id="post-carousel-' . $id . '" class="products clearfix">';
         while ($products->have_posts()) {
             $products->the_post();
             $html .= twoot_generator('load_template', 'loop-product-carousel');
         }
         wp_reset_query();
         $html .= '</ul>';
         $html .= '</div>';
         $html .= twoot_generator('carousel_script', $id, $auto, $speed, $pause, $move_slides, $tag = 'd');
     } else {
         $html = '<div class="the-not-posts">' . esc_attr__('Hi, please check the type option, the current type is not match!', 'Twoot_Toolkit') . '</div>';
     }
     return $html;
 }
开发者ID:sniezekjp,项目名称:prod-fs,代码行数:28,代码来源:onsale-product-carousel.php


示例2: widget

    /**
     * widget function.
     *
     * @see WP_Widget
     * @access public
     * @param array $args
     * @param array $instance
     * @return void
     */
    function widget($args, $instance)
    {
        global $wp_query, $woocommerce;
        $cache = wp_cache_get('widget_onsale', 'widget');
        if (!is_array($cache)) {
            $cache = array();
        }
        if (isset($cache[$args['widget_id']])) {
            echo $cache[$args['widget_id']];
            return;
        }
        ob_start();
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? __('On Sale', 'woocommerce') : $instance['title'], $instance, $this->id_base);
        if (!($number = (int) $instance['number'])) {
            $number = 10;
        } else {
            if ($number < 1) {
                $number = 1;
            } else {
                if ($number > 15) {
                    $number = 15;
                }
            }
        }
        // Get products on sale
        $product_ids_on_sale = woocommerce_get_product_ids_on_sale();
        $product_ids_on_sale[] = 0;
        $meta_query = $woocommerce->query->get_meta_query();
        $query_args = array('posts_per_page' => $number, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'orderby' => 'date', 'order' => 'ASC', 'meta_query' => $meta_query, 'post__in' => $product_ids_on_sale);
        $r = new WP_Query($query_args);
        if ($r->have_posts()) {
            echo $before_widget;
            if ($title) {
                echo $before_title . $title . $after_title;
            }
            echo '<ul class="product_list_widget">';
            while ($r->have_posts()) {
                $r->the_post();
                global $product;
                echo '<li>
					<a href="' . get_permalink() . '">
						' . (has_post_thumbnail() ? get_the_post_thumbnail($r->post->ID, 'shop_thumbnail') : woocommerce_placeholder_img('shop_thumbnail')) . ' ' . get_the_title() . '
					</a> ' . $product->get_price_html() . '
				</li>';
            }
            echo '</ul>';
            echo $after_widget;
        }
        wp_reset_postdata();
        $content = ob_get_clean();
        if (isset($args['widget_id'])) {
            $cache[$args['widget_id']] = $content;
        }
        echo $content;
        wp_cache_set('widget_onsale', $cache, 'widget');
    }
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:66,代码来源:class-wc-widget-onsale.php


示例3: ux_sale_products

function ux_sale_products($atts, $content = null)
{
    global $woocommerce;
    $sliderrandomid = rand();
    extract(shortcode_atts(array("title" => '', 'products' => '8', 'orderby' => 'date', 'order' => 'ASC', 'columns' => '4', 'infinitive' => 'false'), $atts));
    ob_start();
    ?>
    
    <?php 
    /**
     * Check if WooCommerce is active
     **/
    if (function_exists('wc_print_notices')) {
        ?>
    

		<?php 
        if ($title) {
            ?>
 
		<div class="row">
			<div class="large-12 columns">
				<h3 class="section-title"><span><?php 
            echo $title;
            ?>
</span></h3>
			</div>
		</div><!-- end .title -->
		<?php 
        }
        ?>

		<div class="row column-slider">
            <div id="slider_<?php 
        echo $sliderrandomid;
        ?>
" class="iosSlider" style="overflow:hidden;height:250px;min-height:250px;">
                <ul class="slider large-block-grid-<?php 
        echo $columns;
        ?>
 small-block-grid-2">
				 <?php 
        $product_ids_on_sale = woocommerce_get_product_ids_on_sale();
        $product_ids_on_sale[] = 0;
        $meta_query = $woocommerce->query->get_meta_query();
        $query_args = array('posts_per_page' => $products, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'orderby' => $orderby, 'order' => $order, 'meta_query' => $meta_query, 'post__in' => $product_ids_on_sale);
        $r = new WP_Query($query_args);
        if ($r->have_posts()) {
            ?>
                                
                        <?php 
            while ($r->have_posts()) {
                $r->the_post();
                ?>
                    
                            <?php 
                woocommerce_get_template_part('content', 'product');
                ?>
                
                        <?php 
            }
            // end of the loop.
            ?>
                        
                    <?php 
        }
        wp_reset_query();
        ?>
                </ul>   <!-- .slider -->  
                  <div class="sliderControlls">
		        <div class="sliderNav small hide-for-small">
		       		 <a href="javascript:void(0)" class="nextSlide disabled prev_<?php 
        echo $sliderrandomid;
        ?>
"><span class="icon-angle-left"></span></a>
		       		 <a href="javascript:void(0)" class="prevSlide next_<?php 
        echo $sliderrandomid;
        ?>
"><span class="icon-angle-right"></span></a>
		        </div>
       		</div><!-- .sliderControlls -->
       		 </div> <!-- .iOsslider -->
    </div><!-- .row .column-slider -->

		<?php 
        slider_script($sliderrandomid, $columns, $infinitive);
        ?>

    
    <?php 
    }
    ?>

	<?php 
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
开发者ID:javipaur,项目名称:TiendaVirtual,代码行数:98,代码来源:product_sliders.php


示例4: shortcode_sale_products_slider

function shortcode_sale_products_slider($atts, $content = null)
{
    global $woocommerce;
    $sliderrandomid = rand();
    extract(shortcode_atts(array('title' => '', 'per_page' => '12', 'columns' => '4', 'layout' => 'listing', 'orderby' => 'date', 'order' => 'desc'), $atts));
    ob_start();
    ?>

    <?php 
    /**
     * Check if WooCommerce is active
     **/
    if (class_exists('WooCommerce')) {
        ?>
    
     <div class="woocommerce shortcode_products_slider">
         <div id="products-carousel-<?php 
        echo $sliderrandomid;
        ?>
" class="owl-carousel related products">
            <?php 
        // Get products on sale
        $product_ids_on_sale = woocommerce_get_product_ids_on_sale();
        $product_ids_on_sale[] = 0;
        $meta_query = $woocommerce->query->get_meta_query();
        $args = array('posts_per_page' => $per_page, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'orderby' => $orderby, 'order' => $order, 'meta_query' => $meta_query, 'post__in' => $product_ids_on_sale);
        $products = new WP_Query($args);
        if ($products->have_posts()) {
            ?>
                        
                <?php 
            while ($products->have_posts()) {
                $products->the_post();
                ?>
            
                    <ul><?php 
                wc_get_template_part('content', 'product');
                ?>
</ul>
        
                <?php 
            }
            // end of the loop.
            ?>
                
            <?php 
        }
        ?>
        </div>
    </div>
    
    <?php 
    }
    ?>
    
	<script>
	jQuery(document).ready(function($) {

		"use strict";
		
		$("#products-carousel-<?php 
    echo $sliderrandomid;
    ?>
").owlCarousel({
			items:<?php 
    echo $columns;
    ?>
,
			itemsDesktop : [1200,<?php 
    echo $columns;
    ?>
],
			itemsDesktopSmall : [1000,3],
			itemsTablet: false,
			itemsMobile : [600,2],
			lazyLoad : true
		});
	
	});
	</script>

	<?php 
    wp_reset_query();
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
开发者ID:renatodex,项目名称:submundo-blogstore,代码行数:87,代码来源:sale-products-slider.php


示例5: TS_VCSC_WooCommerce_Grid_Basic_Function

 function TS_VCSC_WooCommerce_Grid_Basic_Function($atts, $content = null)
 {
     global $VISUAL_COMPOSER_EXTENSIONS;
     global $product;
     global $woocommerce;
     ob_start();
     if ($VISUAL_COMPOSER_EXTENSIONS->TS_VCSC_VCFrontEditMode == "true") {
         if ($VISUAL_COMPOSER_EXTENSIONS->TS_VCSC_LoadFrontEndForcable == "false") {
             wp_enqueue_style('ts-visual-composer-extend-front');
         }
     } else {
         wp_enqueue_script('ts-extend-hammer');
         wp_enqueue_script('ts-extend-nacho');
         wp_enqueue_style('ts-extend-nacho');
         wp_enqueue_style('ts-extend-dropdown');
         wp_enqueue_script('ts-extend-dropdown');
         wp_enqueue_style('ts-font-ecommerce');
         wp_enqueue_style('ts-extend-animations');
         wp_enqueue_style('dashicons');
         if ($VISUAL_COMPOSER_EXTENSIONS->TS_VCSC_LoadFrontEndForcable == "false") {
             wp_enqueue_style('ts-extend-buttons');
             wp_enqueue_style('ts-visual-composer-extend-front');
             wp_enqueue_script('ts-extend-isotope');
             wp_enqueue_script('ts-visual-composer-extend-front');
         }
         add_action('wp_footer', array($this, 'TS_VCSC_WooCommerce_Grid_Function_Isotope'), 9999);
     }
     extract(shortcode_atts(array('selection' => 'recent_products', 'category' => '', 'ids' => '', 'orderby' => 'date', 'order' => 'desc', 'products_total' => 12, 'exclude_outofstock' => 'false', 'show_image' => 'true', 'show_link' => 'true', 'link_page' => 'false', 'link_target' => '_parent', 'show_rating' => 'true', 'show_stock' => 'true', 'show_price' => 'true', 'show_cart' => 'true', 'show_info' => 'true', 'show_content' => 'excerpt', 'cutoff_characters' => 400, 'lightbox_group_name' => 'nachogroup', 'lightbox_size' => 'full', 'lightbox_effect' => 'random', 'lightbox_speed' => 5000, 'lightbox_social' => 'true', 'lightbox_backlight_choice' => 'predefined', 'lightbox_backlight_color' => '#0084E2', 'lightbox_backlight_custom' => '#000000', 'image_position' => 'ts-imagefloat-center', 'hover_type' => 'ts-imagehover-style1', 'hover_active' => 'false', 'overlay_trigger' => 'ts-trigger-hover', 'rating_maximum' => 5, 'rating_value' => 0, 'rating_dynamic' => '', 'rating_quarter' => 'true', 'rating_size' => 16, 'rating_auto' => 'false', 'rating_rtl' => 'false', 'rating_symbol' => 'other', 'rating_icon' => 'ts-ecommerce-starfull1', 'color_rated' => '#FFD800', 'color_empty' => '#e3e3e3', 'caption_show' => 'false', 'caption_position' => 'left', 'caption_digits' => '.', 'caption_danger' => '#d9534f', 'caption_warning' => '#f0ad4e', 'caption_info' => '#5bc0de', 'caption_primary' => '#428bca', 'caption_success' => '#5cb85c', 'post_type' => 'product', 'date_format' => 'F j, Y', 'time_format' => 'l, g:i A', 'filter_menu' => 'true', 'layout_menu' => 'true', 'sort_menu' => 'false', 'directions_menu' => 'false', 'filter_by' => 'product_cat', 'layout' => 'masonry', 'column_width' => 285, 'layout_break' => 600, 'show_periods' => 'false', 'sort_by' => 'postName', 'sort_order' => 'asc', 'posts_limit' => 25, 'posts_lazy' => 'false', 'posts_ajax' => 10, 'posts_load' => 'Show More', 'posts_trigger' => 'click', 'margin_top' => 0, 'margin_bottom' => 0, 'el_id' => '', 'el_class' => '', 'css' => ''), $atts));
     $postsgrid_random = mt_rand(999999, 9999999);
     $opening = $closing = $controls = $products = '';
     $posts_limit = $products_total;
     if (!empty($el_id)) {
         $posts_container_id = $el_id;
     } else {
         $posts_container_id = 'ts-vcsc-woocommerce-grid-' . $postsgrid_random;
     }
     // Backlight Color
     if ($lightbox_backlight_choice == "predefined") {
         $lightbox_backlight_selection = $lightbox_backlight_color;
     } else {
         $lightbox_backlight_selection = $lightbox_backlight_custom;
     }
     // Check for Front End Editor
     if ($VISUAL_COMPOSER_EXTENSIONS->TS_VCSC_VCFrontEditMode == "true") {
         $product_style = '';
         $frontend_edit = 'true';
         $description_style = 'display: none; padding: 15px;';
     } else {
         $product_style = '';
         $frontend_edit = 'false';
         $description_style = 'display: none; padding: 15px;';
     }
     $meta_query = '';
     // Recent Products
     if ($selection == "recent_products") {
         $meta_query = WC()->query->get_meta_query();
     }
     // Featured Products
     if ($selection == "featured_products") {
         $meta_query = array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN'), array('key' => '_featured', 'value' => 'yes'));
     }
     // Top Rated Products
     if ($selection == "top_rated_products") {
         add_filter('posts_clauses', array(WC()->query, 'order_by_rating_post_clauses'));
         $meta_query = WC()->query->get_meta_query();
     }
     // Final Query Arguments
     $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $products_total, 'orderby' => $orderby, 'order' => $order, 'paged' => 1, 'meta_query' => $meta_query);
     // Products on Sale
     if ($selection == "sale_products") {
         $product_ids_on_sale = woocommerce_get_product_ids_on_sale();
         $meta_query = array();
         $meta_query[] = $woocommerce->query->visibility_meta_query();
         $meta_query[] = $woocommerce->query->stock_status_meta_query();
         $args['meta_query'] = $meta_query;
         $args['post__in'] = $product_ids_on_sale;
     }
     // Best Selling Products
     if ($selection == "best_selling_products") {
         $args['meta_key'] = 'total_sales';
         $args['orderby'] = 'meta_value_num';
         $args['meta_query'] = array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN'));
     }
     // Products in Single Category
     if ($selection == "product_category") {
         $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'terms' => array(esc_attr($category)), 'field' => 'slug', 'operator' => 'IN'));
     }
     // Products in Multiple Categories
     if ($selection == "product_categories") {
         $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'terms' => explode(",", $ids), 'field' => 'term_id', 'operator' => 'IN'));
     }
     $menu_tax = 'product_cat';
     $limit_tax = 'product_cat';
     // Start WordPress Query
     $loop = new WP_Query($args);
     // Language Settings: Isotope Posts
     $TS_VCSC_Isotope_Posts_Language = get_option('ts_vcsc_extend_settings_translationsIsotopePosts', '');
     if ($TS_VCSC_Isotope_Posts_Language == false || empty($TS_VCSC_Isotope_Posts_Language)) {
         $TS_VCSC_Isotope_Posts_Language = $VISUAL_COMPOSER_EXTENSIONS->TS_VCSC_Isotope_Posts_Language_Defaults;
     }
//.........这里部分代码省略.........
开发者ID:ryansm,项目名称:saud,代码行数:101,代码来源:ts_vcsc_woocommerce_custom_grid.php


示例6: esc_attr

" data-carousel-id="hproductsale" data-carousel-md="<?php 
echo esc_attr($md);
?>
" data-carousel-sm="<?php 
echo esc_attr($sm);
?>
" data-carousel-xs="<?php 
echo esc_attr($xs);
?>
" data-carousel-ss="<?php 
echo esc_attr($ss);
?>
">
				<?php 
global $woocommerce, $woocommerce_loop;
$product_ids_on_sale = woocommerce_get_product_ids_on_sale();
$product_ids_on_sale[] = 0;
$meta_query = array();
$meta_query[] = $woocommerce->query->visibility_meta_query();
$meta_query[] = $woocommerce->query->stock_status_meta_query();
$temp = $wp_query;
$wp_query = null;
$wp_query = new WP_Query();
$wp_query->query(array('post_type' => 'product', 'meta_query' => $meta_query, 'post__in' => $product_ids_on_sale, 'post_status' => 'publish', 'orderby' => 'menu_order', 'posts_per_page' => $hp_proscount));
$woocommerce_loop['columns'] = $product_tcolumn;
if ($wp_query) {
    while ($wp_query->have_posts()) {
        $wp_query->the_post();
        wc_get_template_part('content', 'product');
    }
}
开发者ID:MikeBu,项目名称:wp-fm.com,代码行数:31,代码来源:product-sale-carousel.php


示例7: TS_VCSC_WooCommerce_ImageGrid_Basic_Function

 function TS_VCSC_WooCommerce_ImageGrid_Basic_Function($atts, $content = null)
 {
     global $VISUAL_COMPOSER_EXTENSIONS;
     global $product;
     global $woocommerce;
     ob_start();
     wp_enqueue_script('ts-extend-hammer');
     wp_enqueue_script('ts-extend-nacho');
     wp_enqueue_style('ts-extend-nacho');
     wp_enqueue_style('ts-font-ecommerce');
     wp_enqueue_style('ts-extend-simptip');
     wp_enqueue_style('ts-extend-animations');
     wp_enqueue_style('ts-visual-composer-extend-front');
     wp_enqueue_script('ts-visual-composer-extend-front');
     extract(shortcode_atts(array('selection' => 'recent_products', 'category' => '', 'ids' => '', 'orderby' => 'date', 'order' => 'desc', 'products_total' => 12, 'exclude_outofstock' => 'false', 'post_type' => 'product', 'limit_posts' => 'true', 'limit_by' => 'category', 'limit_term' => '', 'filter_by' => 'category', 'posts_limit' => 25, 'content_images_size' => 'medium', 'filters_show' => 'true', 'filters_available' => 'Available Groups', 'filters_selected' => 'Filtered Groups', 'filters_nogroups' => 'No Groups', 'filters_toggle' => 'Toggle Filter', 'filters_toggle_style' => '', 'filters_showall' => 'Show All', 'filters_showall_style' => '', 'data_grid_machine' => 'internal', 'data_grid_invalid' => 'false', 'data_grid_target' => '_blank', 'data_grid_breaks' => '240,480,720,960', 'data_grid_width' => 250, 'data_grid_space' => 2, 'data_grid_order' => 'false', 'data_grid_always' => 'true', 'data_grid_price' => 'true', 'fullwidth' => 'false', 'breakouts' => 6, 'margin_top' => 0, 'margin_bottom' => 0, 'el_id' => '', 'el_class' => '', 'css' => ''), $atts));
     // Check for Front End Editor
     if ($VISUAL_COMPOSER_EXTENSIONS->TS_VCSC_VCFrontEditMode == "true") {
         $grid_class = 'ts-image-link-grid-edit';
         $grid_message = '<div class="ts-composer-frontedit-message">' . __('The grid is currently viewed in front-end edit mode; grid and filter features are disabled for performance and compatibility reasons.', "ts_visual_composer_extend") . '</div>';
         $image_style = 'width: 20%; height: 100%; display: inline-block; margin: 0; padding: 0;';
         $grid_style = 'height: 100%;';
         $frontend_edit = 'true';
     } else {
         if ($data_grid_machine == 'internal') {
             $grid_class = 'ts-image-link-grid';
         } else {
             if ($data_grid_machine == 'freewall') {
                 $grid_class = 'ts-freewall-link-grid';
             }
         }
         $image_style = '';
         $grid_style = '';
         $grid_message = '';
         $frontend_edit = 'false';
     }
     $randomizer = mt_rand(999999, 9999999);
     if (!empty($el_id)) {
         $modal_id = $el_id;
     } else {
         $modal_id = 'ts-vcsc-product-link-grid-' . $randomizer;
     }
     $valid_images = 0;
     if (!empty($data_grid_breaks)) {
         $data_grid_breaks = str_replace(' ', '', $data_grid_breaks);
         $count_columns = substr_count($data_grid_breaks, ",") + 1;
     } else {
         $count_columns = 0;
     }
     $i = -1;
     $b = 0;
     $output = '';
     if ($filters_toggle_style != '') {
         wp_enqueue_style('ts-extend-buttonsflat');
     }
     wp_enqueue_style('ts-extend-multiselect');
     wp_enqueue_script('ts-extend-multiselect');
     $meta_query = '';
     $menu_tax = 'product_cat';
     $limit_tax = 'product_cat';
     // Recent Products
     if ($selection == "recent_products") {
         $meta_query = WC()->query->get_meta_query();
     }
     // Featured Products
     if ($selection == "featured_products") {
         $meta_query = array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN'), array('key' => '_featured', 'value' => 'yes'));
     }
     // Top Rated Products
     if ($selection == "top_rated_products") {
         add_filter('posts_clauses', array(WC()->query, 'order_by_rating_post_clauses'));
         $meta_query = WC()->query->get_meta_query();
     }
     // Final Query Arguments
     $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $products_total, 'orderby' => $orderby, 'order' => $order, 'paged' => 1, 'meta_query' => $meta_query);
     // Products on Sale
     if ($selection == "sale_products") {
         $product_ids_on_sale = woocommerce_get_product_ids_on_sale();
         $meta_query = array();
         $meta_query[] = $woocommerce->query->visibility_meta_query();
         $meta_query[] = $woocommerce->query->stock_status_meta_query();
         $args['meta_query'] = $meta_query;
         $args['post__in'] = $product_ids_on_sale;
     }
     // Best Selling Products
     if ($selection == "best_selling_products") {
         $args['meta_key'] = 'total_sales';
         $args['orderby'] = 'meta_value_num';
         $args['meta_query'] = array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN'));
     }
     // Products in Single Category
     if ($selection == "product_category") {
         $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'terms' => array(esc_attr($category)), 'field' => 'slug', 'operator' => 'IN'));
     }
     // Products in Multiple Categories
     if ($selection == "product_categories") {
         $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'terms' => explode(",", $ids), 'field' => 'term_id', 'operator' => 'IN'));
     }
     // Start WordPress Query
     $loop = new WP_Query($args);
     if ($data_grid_machine == 'internal') {
//.........这里部分代码省略.........
开发者ID:Telemedellin,项目名称:fonvalmed,代码行数:101,代码来源:ts_vcsc_woocommerce_custom_image.php


示例8: sale_products

    /**
     * List all products on sale
     *
     * @access public
     * @param array $atts
     * @return string
     */
    public function sale_products($atts)
    {
        global $woocommerce_loop, $woocommerce;
        extract(shortcode_atts(array('per_page' => '12', 'columns' => '4', 'orderby' => 'title', 'order' => 'asc'), $atts));
        // Get products on sale
        $product_ids_on_sale = woocommerce_get_product_ids_on_sale();
        $meta_query = array();
        $meta_query[] = $woocommerce->query->visibility_meta_query();
        $meta_query[] = $woocommerce->query->stock_status_meta_query();
        $meta_query = array_filter($meta_query);
        $args = array('posts_per_page' => $per_page, 'orderby' => $orderby, 'order' => $order, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'meta_query' => $meta_query, 'post__in' => $product_ids_on_sale);
        ob_start();
        $products = new WP_Query($args);
        $woocommerce_loop['columns'] = $columns;
        if ($products->have_posts()) {
            ?>

			<?php 
            woocommerce_product_loop_start();
            ?>

				<?php 
            while ($products->have_posts()) {
                $products->the_post();
                ?>

					<?php 
                woocommerce_get_template_part('content', 'product');
                ?>

				<?php 
            }
            // end of the loop.
            ?>

			<?php 
            woocommerce_product_loop_end();
            ?>

		<?php 
        }
        wp_reset_postdata();
        return '<div class="woocommerce">' . ob_get_clean() . '</div>';
    }
开发者ID:rongandat,项目名称:sallumeh,代码行数:51,代码来源:class-wc-shortcodes.php


示例9: TS_VCSC_WooCommerce_Slider_Basic_Function

 function TS_VCSC_WooCommerce_Slider_Basic_Function($atts, $content = null)
 {
     global $VISUAL_COMPOSER_EXTENSIONS;
     global $product;
     global $woocommerce;
     ob_start();
     wp_enqueue_script('ts-extend-hammer');
     wp_enqueue_script('ts-extend-nacho');
     wp_enqueue_style('ts-extend-nacho');
     if ($VISUAL_COMPOSER_EXTENSIONS->TS_VCSC_LoadFrontEndWaypoints == "true") {
         if (wp_script_is('waypoints', $list = 'registered')) {
             wp_enqueue_script('waypoints');
         } else {
             wp_enqueue_script('ts-extend-waypoints');
         }
     }
     wp_enqueue_style('ts-extend-owlcarousel2');
     wp_enqueue_script('ts-extend-owlcarousel2');
     wp_enqueue_style('ts-font-ecommerce');
     wp_enqueue_style('ts-extend-animations');
     wp_enqueue_style('ts-visual-composer-extend-front');
     wp_enqueue_script('ts-visual-composer-extend-front');
     extract(shortcode_atts(array('selection' => 'recent_products', 'category' => '', 'ids' => '', 'orderby' => 'date', 'order' => 'desc', 'products_total' => 12, 'exclude_outofstock' => 'false', 'show_image' => 'true', 'link_page' => 'false', 'link_target' => '_parent', 'show_rating' => 'true', 'show_stock' => 'true', 'show_price' => 'true', 'show_link' => 'true', 'show_cart' => 'true', 'show_info' => 'true', 'show_content' => 'excerpt', 'cutoff_characters' => 400, 'products_slide' => 4, 'breakpoints_custom' => 'false', 'breakpoints_items' => '1,2,3,4,5,6,7,8', 'auto_height' => 'false', 'page_rtl' => 'false', 'auto_play' => 'false', 'show_bar' => 'false', 'bar_color' => '#dd3333', 'show_speed' => 5000, 'stop_hover' => 'true', 'show_navigation' => 'true', 'show_dots' => 'true', 'items_loop' => 'false', 'animation_in' => 'ts-viewport-css-flipInX', 'animation_out' => 'ts-viewport-css-slideOutDown', 'animation_mobile' => 'false', 'lightbox_group_name' => 'nachogroup', 'lightbox_size' => 'full', 'lightbox_effect' => 'random', 'lightbox_speed' => 5000, 'lightbox_social' => 'true', 'lightbox_backlight_choice' => 'predefined', 'lightbox_backlight_color' => '#0084E2', 'lightbox_backlight_custom' => '#000000', 'image_position' => 'ts-imagefloat-center', 'hover_type' => 'ts-imagehover-style1', 'hover_active' => 'false', 'overlay_trigger' => 'ts-trigger-hover', 'rating_maximum' => 5, 'rating_value' => 0, 'rating_quarter' => 'true', 'rating_dynamic' => '', 'rating_size' => 16, 'rating_auto' => 'false', 'rating_rtl' => 'false', 'rating_symbol' => 'other', 'rating_icon' => 'ts-ecommerce-starfull1', 'color_rated' => '#FFD800', 'color_empty' => '#e3e3e3', 'caption_show' => 'false', 'caption_position' => 'left', 'caption_digits' => '.', 'caption_danger' => '#d9534f', 'caption_warning' => '#f0ad4e', 'caption_info' => '#5bc0de', 'caption_primary' => '#428bca', 'caption_success' => '#5cb85c', 'margin_top' => 0, 'margin_bottom' => 0, 'el_id' => '', 'el_class' => '', 'css' => ''), $atts));
     $woo_random = mt_rand(999999, 9999999);
     if (!empty($el_id)) {
         $woo_slider_id = $el_id;
     } else {
         $woo_slider_id = 'ts-vcsc-woocommerce-slider-' . $woo_random;
     }
     $output = '';
     // Backlight Color
     if ($lightbox_backlight_choice == "predefined") {
         $lightbox_backlight_selection = $lightbox_backlight_color;
     } else {
         $lightbox_backlight_selection = $lightbox_backlight_custom;
     }
     // Check for Front End Editor
     if ($VISUAL_COMPOSER_EXTENSIONS->TS_VCSC_VCFrontEditMode == "true") {
         $slider_class = 'owl-carousel2-edit';
         $slider_message = '<div class="ts-composer-frontedit-message">' . __('The slider is currently viewed in front-end edit mode; slider features are disabled for performance and compatibility reasons.', "ts_visual_composer_extend") . '</div>';
         $product_style = 'width: ' . 100 / $products_slide . '%; height: 100%; float: left; margin: 0; padding: 0;';
         $frontend_edit = 'true';
         $description_style = 'display: none; padding: 15px;';
     } else {
         $slider_class = 'ts-owlslider-parent owl-carousel2';
         $slider_message = '';
         $product_style = '';
         $frontend_edit = 'false';
         $description_style = 'display: none; padding: 15px;';
     }
     $meta_query = '';
     // Recent Products
     if ($selection == "recent_products") {
         $meta_query = WC()->query->get_meta_query();
     }
     // Featured Products
     if ($selection == "featured_products") {
         $meta_query = array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN'), array('key' => '_featured', 'value' => 'yes'));
     }
     // Top Rated Products
     if ($selection == "top_rated_products") {
         add_filter('posts_clauses', array(WC()->query, 'order_by_rating_post_clauses'));
         $meta_query = WC()->query->get_meta_query();
     }
     // Final Query Arguments
     $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $frontend_edit == "true" ? $products_slide : $products_total, 'orderby' => $orderby, 'order' => $order, 'paged' => 1, 'meta_query' => $meta_query);
     // Products on Sale
     if ($selection == "sale_products") {
         $product_ids_on_sale = woocommerce_get_product_ids_on_sale();
         $meta_query = array();
         $meta_query[] = $woocommerce->query->visibility_meta_query();
         $meta_query[] = $woocommerce->query->stock_status_meta_query();
         $args['meta_query'] = $meta_query;
         $args['post__in'] = $product_ids_on_sale;
     }
     // Best Selling Products
     if ($selection == "best_selling_products") {
         $args['meta_key'] = 'total_sales';
         $args['orderby'] = 'meta_value_num';
         $args['meta_query'] = array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN'));
     }
     // Products in Single Category
     if ($selection == "product_category") {
         $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'terms' => array(esc_attr($category)), 'field' => 'slug', 'operator' => 'IN'));
     }
     // Products in Multiple Categories
     if ($selection == "product_categories") {
         $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'terms' => explode(",", $ids), 'field' => 'term_id', 'operator' => 'IN'));
     }
     // Start WordPress Query
     $loop = new WP_Query($args);
     if (function_exists('vc_shortcode_custom_css_class')) {
         $css_class = apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $slider_class . ' ' . $el_class . ' ' . vc_shortcode_custom_css_class($css, ' '), 'TS_VCSC_WooCommerce_Slider_Basic', $atts);
     } else {
         $css_class = $slider_class . ' ' . $el_class;
     }
     $output .= '<div id="' . $woo_slider_id . '-container" class="ts-woocommerce-slider-container">';
     // Add Progressbar
     if ($auto_play == "true" && $show_bar == "true" && $frontend_edit == "false") {
         $output .= '<div id="ts-owlslider-progressbar-' . $woo_random . '" class="ts-owlslider-progressbar-holder" style=""><div class="ts-owlslider-progressbar" style="background: ' . $bar_color . '; height: 100%; width: 0%;"></div></div>';
//.........这里部分代码省略.........
开发者ID:Telemedellin,项目名称:fonvalmed,代码行数:101,代码来源:ts_vcsc_woocommerce_custom_slider.php


示例10: sf_product_items

    function sf_product_items($asset_type, $category, $carousel, $product_size, $item_count, $width)
    {
        global $woocommerce, $woocommerce_loop;
        $args = array();
        // ARRAY ARGUMENTS
        if ($asset_type == "latest-products") {
            $args = array('post_type' => 'product', 'post_status' => 'publish', 'product_cat' => $category, 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count);
            $args['meta_query'] = array();
            $args['meta_query'][] = $woocommerce->query->stock_status_meta_query();
            $args['meta_query'][] = $woocommerce->query->visibility_meta_query();
        } else {
            if ($asset_type == "featured-products") {
                $args = array('post_type' => 'product', 'post_status' => 'publish', 'product_cat' => $category, 'ignore_sticky_posts' => 1, 'meta_key' => '_featured', 'meta_value' => 'yes', 'posts_per_page' => $item_count);
            } else {
                if ($asset_type == "top-rated") {
                    add_filter('posts_clauses', array($woocommerce->query, 'order_by_rating_post_clauses'));
                    $args = array('post_type' => 'product', 'post_status' => 'publish', 'product_cat' => $category, 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count);
                    $args['meta_query'] = $woocommerce->query->get_meta_query();
                } else {
                    if ($asset_type == "recently-viewed") {
                        // Get recently viewed product cookies data
                        $viewed_products = !empty($_COOKIE['woocommerce_recently_viewed']) ? (array) explode('|', $_COOKIE['woocommerce_recently_viewed']) : array();
                        $viewed_products = array_filter(array_map('absint', $viewed_products));
                        // If no data, quit
                        if (empty($viewed_products)) {
                            return '<p class="no-products">' . __("You haven't viewed any products yet.", "swiftframework") . '</p>';
                        }
                        // Create query arguments array
                        $args = array('post_type' => 'product', 'post_status' => 'publish', 'product_cat' => $category, 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count, 'no_found_rows' => 1, 'post__in' => $viewed_products, 'orderby' => 'rand');
                        // Add meta_query to query args
                        //$args['meta_query'] = array();
                        // Check products stock status
                        //$args['meta_query'][] = $woocommerce->query->stock_status_meta_query();
                    } else {
                        if ($asset_type == "sale-products") {
                            // Get products on sale
                            $product_ids_on_sale = woocommerce_get_product_ids_on_sale();
                            $meta_query = array();
                            $meta_query[] = $woocommerce->query->visibility_meta_query();
                            $meta_query[] = $woocommerce->query->stock_status_meta_query();
                            $args = array('no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'orderby' => 'date', 'order' => 'ASC', 'product_cat' => $category, 'posts_per_page' => $item_count, 'meta_query' => $meta_query, 'post__in' => $product_ids_on_sale);
                        } else {
                            $args = array('posts_per_page' => $item_count, 'post_status' => 'publish', 'post_type' => 'product', 'meta_key' => 'total_sales', 'orderby' => 'meta_value_num', 'no_found_rows' => 1, 'product_cat' => $category);
                            $args['meta_query'] = array();
                            $args['meta_query'][] = $woocommerce->query->stock_status_meta_query();
                            $args['meta_query'][] = $woocommerce->query->visibility_meta_query();
                        }
                    }
                }
            }
        }
        ob_start();
        // OUTPUT PRODUCTS
        $products = new WP_Query($args);
        global $sf_sidebar_config, $sf_carouselID;
        if ($sf_carouselID == "") {
            $sf_carouselID = 1;
        } else {
            $sf_carouselID++;
        }
        if (is_singular('portfolio')) {
            $sf_sidebar_config = "no-sidebars";
        }
        $columns = 4;
        if ($sf_sidebar_config == "no-sidebars") {
            if ($width == "3/4") {
                $woocommerce_loop['columns'] = apply_filters('loop_shop_columns', 3);
                $columns = 3;
            } else {
                if ($width == "1/2") {
                    $woocommerce_loop['columns'] = apply_filters('loop_shop_columns', 2);
                    $columns = 2;
                } else {
                    if ($width == "1/4") {
                        $woocommerce_loop['columns'] = apply_filters('loop_shop_columns', 1);
                        $columns = 1;
                    } else {
                        if ($product_size == "mini") {
                            $woocommerce_loop['columns'] = apply_filters('loop_shop_columns', 6);
                            $columns = 6;
                        } else {
                            $woocommerce_loop['columns'] = apply_filters('loop_shop_columns', 4);
                        }
                    }
                }
            }
        } else {
            if ($sf_sidebar_config == "one-sidebar") {
                if ($width == "3/4") {
                    $woocommerce_loop['columns'] = apply_filters('loop_shop_columns', 3);
                    $columns = 3;
                } else {
                    if ($width == "1/2") {
                        $woocommerce_loop['columns'] = apply_filters('loop_shop_columns', 2);
                        $columns = 2;
                    } else {
                        if ($width == "1/4") {
                            $woocommerce_loop['columns'] = apply_filters('loop_shop_columns', 1);
                            $columns = 1;
                        } else {
//.........这里部分代码省略.........
开发者ID:nhatnam1102,项目名称:wp-content,代码行数:101,代码来源:sf-products.php


示例11: array

                    $taxonomy_value = $pw_query['ex_' . $taxonomy];
                    $query_tax_query[] = array('taxonomy' => $taxonomy, 'field' => 'id', 'terms' => $taxonomy_value, 'operator' => 'Not IN');
                }
            }
        }
        $query_by_id_in = '';
        if (isset($pw_query['in_ids'])) {
            $query_by_id_in = $pw_query['in_ids'];
        }
        $query_by_id_not_in = '';
        if (isset($pw_query['ex_ids'])) {
            $query_by_id_not_in = $pw_query['ex_ids'];
        }
        break;
    case "on_sale_product":
        $query_by_id_in = woocommerce_get_product_ids_on_sale();
        $query_by_id_in[] = 0;
        break;
    case "in_stock_product":
        $query_meta_query[] = array('key' => '_stock_status', 'value' => "instock", 'compare' => '=');
        break;
    case "out_stock_product":
        $query_meta_query[] = array('key' => '_stock_status', 'value' => "outofstock", 'compare' => '=');
        break;
}
$query_meta_key = '';
$query_orderby = '';
if (isset($pw_woo_ad_main_class->custom_field[__PW_WOO_AD_SEARCH_FIELDS_PERFIX__ . 'build_query_order_by'])) {
    $pw_query_order = $pw_woo_ad_main_class->custom_field[__PW_WOO_AD_SEARCH_FIELDS_PERFIX__ . 'build_query_order_by'];
    $public_orders_array = array('ID', 'date', 'author', 'title', 'modified', 'rand', 'comment_count', 'menu_order');
    if (in_array($pw_query_order, $public_orders_array)) {
开发者ID:hikaram,项目名称:wee,代码行数:31,代码来源:build_fetch_query.php


示例12: TS_VCSC_WooCommerce_Ticker_Basic_Function

        function TS_VCSC_WooCommerce_Ticker_Basic_Function($atts, $content = null)
        {
            global $VISUAL_COMPOSER_EXTENSIONS;
            global $product;
            global $woocommerce;
            ob_start();
            wp_enqueue_script('ts-extend-newsticker');
            wp_enqueue_style('ts-font-ecommerce');
            wp_enqueue_style('ts-font-teammatess');
            if ($VISUAL_COMPOSER_EXTENSIONS->TS_VCSC_LoadFrontEndForcable == "false") {
                wp_enqueue_style('ts-extend-animations');
                wp_enqueue_style('ts-visual-composer-extend-front');
                wp_enqueue_script('ts-visual-composer-extend-front');
            }
            extract(shortcode_atts(array('selection' => 'recent_products', 'category' => '', 'ids' => '', 'orderby' => 'date', 'order' => 'desc', 'products_total' => 12, 'exclude_outofstock' => 'false', 'post_type' => 'product', 'date_format' => 'F j, Y', 'time_format' => 'l, g:i A', 'limit_posts' => 'true', 'limit_by' => 'category', 'limit_term' => '', 'filter_menu' => 'true', 'layout_menu' => 'true', 'sort_menu' => 'false', 'directions_menu' => 'false', 'filter_by' => 'category', 'ticker_direction' => 'up', 'ticker_speed' => 3000, 'ticker_break' => 480, 'ticker_border_type' => '', 'ticker_border_thick' => 1, 'ticker_border_color' => '#ededed', 'ticker_border_radius' => '', 'ticker_auto' => 'false', 'ticker_hover' => 'true', 'ticker_controls' => 'true', 'ticker_symbol' => 'false', 'ticker_icon' => '', 'ticker_paint' => '#ffffff', 'ticker_title' => 'true', 'ticker_header' => 'Latest Products', 'ticker_background' => '#D10000', 'ticker_color' => '#ffffff', 'ticker_type' => 'true', 'ticker_image' => 'true', 'ticker_price' => 'true', 'ticker_cart' => 'true', 'ticker_add_item' => 'Add This Item', 'ticker_remove_item' => 'Remove This Item', 'ticker_rating' => 'true', 'ticker_stock' => 'false', 'ticker_side' => 'left', 'ticker_fixed' => 'false', 'ticker_position' => 'top', 'ticker_adjustment' => 0, 'ticker_target' => '_parent', 'posts_limit' => 25, 'rating_maximum' => 5, 'rating_size' => 20, 'rating_quarter' => 'true', 'rating_name' => 'true', 'rating_auto' => 'true', 'rating_position' => 'top', 'rating_rtl' => 'false', 'rating_symbol' => 'other', 'rating_icon' => 'ts-ecommerce-starfull1', 'color_rated' => '#FFD800', 'color_empty' => '#e3e3e3', 'caption_show' => 'true', 'caption_position' => 'left', 'caption_digits' => '.', 'caption_danger' => '#d9534f', 'caption_warning' => '#f0ad4e', 'caption_info' => '#5bc0de', 'caption_primary' => '#428bca', 'caption_success' => '#5cb85c', 'margin_top' => 0, 'margin_bottom' => 0, 'el_id' => '', 'el_class' => '', 'css' => ''), $atts));
            $woo_random = mt_rand(999999, 9999999);
            if (!empty($el_id)) {
                $woo_ticker_id = $el_id;
            } else {
                $woo_ticker_id = 'ts-vcsc-woocommerce-ticker-' . $woo_random;
            }
            $output = '';
            // Check for Front End Editor
            if ($VISUAL_COMPOSER_EXTENSIONS->TS_VCSC_VCFrontEditMode == "true") {
                $frontend_edit = 'true';
                $ticker_fixed = 'false';
                $ticker_auto = 'false';
            } else {
                $frontend_edit = 'false';
                $ticker_fixed = $ticker_fixed;
                $ticker_auto = $ticker_auto;
            }
            $meta_query = '';
            // Recent Products
            if ($selection == "recent_products") {
                $meta_query = WC()->query->get_meta_query();
            }
            // Featured Products
            if ($selection == "featured_products") {
                $meta_query = array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN'), array('key' => '_featured', 'value' => 'yes'));
            }
            // Top Rated Products
            if ($selection == "top_rated_products") {
                add_filter('posts_clauses', array(WC()->query, 'order_by_rating_post_clauses'));
                $meta_query = WC()->query->get_meta_query();
            }
            // Final Query Arguments
            $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $products_total, 'orderby' => $orderby, 'order' => $order, 'paged' => 1, 'meta_query' => $meta_query);
            // Products on Sale
            if ($selection == "sale_products") {
                $product_ids_on_sale = woocommerce_get_product_ids_on_sale();
                $meta_query = array();
                $meta_query[] = $woocommerce->query->visibility_meta_query();
                $meta_query[] = $woocommerce->query->stock_status_meta_query();
                $args['meta_query'] =  

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP woocommerce_get_product_schema函数代码示例发布时间:2022-05-23
下一篇:
PHP woocommerce_get_page_id函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap