当前位置: 首页>>代码示例>>PHP>>正文


PHP WC_Product::get_rating_html方法代码示例

本文整理汇总了PHP中WC_Product::get_rating_html方法的典型用法代码示例。如果您正苦于以下问题:PHP WC_Product::get_rating_html方法的具体用法?PHP WC_Product::get_rating_html怎么用?PHP WC_Product::get_rating_html使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WC_Product的用法示例。


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

示例1: extract


//.........这里部分代码省略.........
         $display_type = '';
     }
     if (!isset($columns)) {
         $columns = '4';
     }
     if (isset($per_page)) {
         $post_count = $per_page;
     }
     if (isset($number)) {
         $post_count = $number;
     }
     if (!isset($order)) {
         $order = 'ASC';
     }
     if (!isset($orderby)) {
         $orderby = 'date';
     }
     if (!isset($category)) {
         $category = '';
     }
     if (!isset($ids)) {
         $ids = '';
     }
     if ($ids) {
         $ids = explode(',', $ids);
         $ids = array_map('trim', $ids);
     }
     if ($columns == "2") {
         $columns = 6;
     } elseif ($columns == "3") {
         $columns = 4;
     } elseif ($columns == "4") {
         $columns = 3;
     }
     $meta_query = '';
     if ($display_type == "recent_products") {
         $meta_query = WC()->query->get_meta_query();
     }
     if ($display_type == "featured_products") {
         $meta_query = array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN'), array('key' => '_featured', 'value' => 'yes'));
     }
     if ($display_type == "top_rated_products") {
         add_filter('posts_clauses', array(WC()->query, 'order_by_rating_post_clauses'));
         $meta_query = WC()->query->get_meta_query();
     }
     $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $post_count, 'orderby' => $orderby, 'order' => $order, 'meta_query' => $meta_query);
     if ($display_type == "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;
     }
     if ($display_type == "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'));
     }
     if ($display_type == "product_category") {
         $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'terms' => array(esc_attr($category)), 'field' => 'slug', 'operator' => 'IN'));
     }
     if ($display_type == "product_categories") {
         $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'terms' => $ids, 'field' => 'term_id', 'operator' => 'IN'));
     }
     $query = new WP_Query($args);
     $output .= '<ul class="wcmp-product-list wcmp-img-' . $img_position . ' ' . $order . '">';
     if ($query->have_posts()) {
         while ($query->have_posts()) {
             $query->the_post();
             $product_id = get_the_ID();
             $post = get_post($product_id);
             $product_title = get_the_title();
             $product = new WC_Product($product_id);
             $attachment_ids = $product->get_gallery_attachment_ids();
             $price = $product->get_price_html();
             $rating = $product->get_rating_html();
             $product_var = new WC_Product_Variable($product_id);
             $available_variations = $product_var->get_available_variations();
             $output .= '<li>';
             $output .= '<a href="' . get_permalink($product_id) . '">';
             $product_img = wp_get_attachment_image_src(get_post_thumbnail_id($product_id), 'full');
             $output .= '<img style="' . $style . '" src="' . $product_img[0] . '"/>';
             $output .= '<span style="' . $title_style . '">' . $product_title . '</span>';
             $output .= '</a>';
             if ($display_type == "top_rated_products") {
                 $output .= '<div style="' . $rating_style . '">' . $rating . '</div>';
             }
             $output .= '<span class="amount" style="' . $pricing_style . '">' . $price . '</span>';
             $output .= '</li>';
         }
     }
     $output .= "\n" . '</ul>';
     $output .= "\n" . '</div>';
     if ($display_type == "top_rated_products") {
         remove_filter('posts_clauses', array(WC()->query, 'order_by_rating_post_clauses'));
     }
     wp_reset_postdata();
     return $output;
 }
开发者ID:ksingh812,项目名称:epb,代码行数:101,代码来源:shortcode_list.php

示例2: WooComposer_Loop_style04


//.........这里部分代码省略.........
    if ($display_type == "product_categories") {
        $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'terms' => $ids, 'field' => 'term_id', 'operator' => 'IN'));
    }
    $test = '';
    if (vc_is_inline()) {
        $test = "wcmp_vc_inline";
    }
    if ($product_animation == '') {
        $product_animation = 'no-animation';
    } else {
        $style .= 'opacity:1;';
    }
    if ($element == "grid") {
        $class = 'vc_span' . $columns . ' ';
    }
    $output .= '<div class="woocomposer ' . $test . '" data-columns="' . $col . '">';
    $query = new WP_Query($args);
    if ($query->have_posts()) {
        while ($query->have_posts()) {
            $query->the_post();
            $product_id = get_the_ID();
            $uid = uniqid();
            $output .= '<div id="product-' . $uid . '" style="' . $style . '" class="' . $class . ' wpb_column column_container wooproduct" data-animation="animated ' . $product_animation . '">';
            if ($element == 'carousel') {
                $output .= '<div class="wcmp-carousel-item">';
            }
            $product_title = get_the_title($product_id);
            $post = get_post($product_id);
            $product_desc = get_post($product_id)->post_excerpt;
            $product_img = wp_get_attachment_image_src(get_post_thumbnail_id($product_id), $image_size);
            $product = new WC_Product($product_id);
            $attachment_ids = $product->get_gallery_attachment_ids();
            $price = $product->get_price_html();
            $rating = $product->get_rating_html();
            $attributes = $product->get_attributes();
            $stock = $product->is_in_stock() ? 'InStock' : 'OutOfStock';
            if ($product->is_on_sale()) {
                $on_sale = apply_filters('woocommerce_sale_flash', $label_on_sale, $post, $product);
            } else {
                $on_sale = '';
            }
            if ($quick_view_style == "expandable") {
                $quick_view_class = 'quick-view-loop';
            } else {
                $quick_view_class = 'quick-view-loop-popup';
            }
            $cat_count = sizeof(get_the_terms($product_id, 'product_cat'));
            $tag_count = sizeof(get_the_terms($product_id, 'product_tag'));
            $categories = $product->get_categories(', ', '<span class="posted_in">' . _n('', '', $cat_count, 'woocommerce') . ' ', '.</span>');
            $tags = $product->get_tags(', ', '<span class="tagged_as">' . _n('', '', $tag_count, 'woocommerce') . ' ', '.</span>');
            $output .= "\n" . '<div class="wcmp-product woocommerce wcmp-' . $product_style . ' ' . $img_animate . '" style="' . $border . ' ' . $desc_style . '">';
            $output .= "\n\t" . '<div class="wcmp-product-image">';
            if (empty($attachment_ids) && count($attachment_ids) > 1 && $product_img_disp == "carousel") {
                $uniqid = uniqid();
                $output .= '<div class="wcmp-single-image-carousel carousel-in-loop">';
                $product_img = wp_get_attachment_image_src(get_post_thumbnail_id($product_id), $image_size);
                if ($lazy_images == "enable") {
                    $src = plugins_url('../assets/img/loader.gif', __FILE__);
                } else {
                    $src = $product_img[0];
                }
                $output .= '<div><div class="wcmp-image"><img class="wcmp-img" src="' . $src . '" data-src="' . $product_img[0] . '"/></div></div>';
                foreach ($attachment_ids as $attachment_id) {
                    $product_img = wp_get_attachment_image_src($attachment_id, $image_size);
                    if ($lazy_images == "enable") {
                        $src = plugins_url('../assets/img/loader.gif', __FILE__);
开发者ID:RDePoppe,项目名称:luminaterealestate,代码行数:67,代码来源:design-loop-style04.php

示例3: array


//.........这里部分代码省略.........
         foreach ($front_edit_reverse as $key => $value) {
             if ($key == $sort_order) {
                 echo '<div>' . __("Initial Order", "ts_visual_composer_extend") . ': ' . $value . '</div>';
             }
         }
         echo '<div>' . __("Show Filter Button", "ts_visual_composer_extend") . ': ' . $filter_menu . '</div>';
         echo '<div>' . __("Show Layout Button", "ts_visual_composer_extend") . ': ' . $layout_menu . '</div>';
         echo '<div>' . __("Show Sort Criterion Button", "ts_visual_composer_extend") . ': ' . $sort_menu . '</div>';
         echo '<div>' . __("Show Directions Buttons", "ts_visual_composer_extend") . ': ' . $directions_menu . '</div>';
         echo '</div>';
     } else {
         $opening .= '<div id="' . $posts_container_id . '" class="ts-isotope-posts-grid-parent ' . ($layout == 'spineTimeline' ? 'ts-timeline ' : 'ts-postsgrid ') . 'ts-timeline-' . $sort_order . ' ts-posts-timeline ' . $isotope_posts_list_class . ' ' . $css_class . '" style="margin-top: ' . $margin_top . 'px; margin-bottom: ' . $margin_bottom . ';" data-lazy="' . $posts_lazy . '" data-count="' . $posts_limit . '" data-ajax="' . $posts_ajax . '" data-trigger="' . $posts_trigger . '" data-column="' . $column_width . '" data-layout="' . $layout . '" data-sort="' . $sort_by . '" data-order="' . $sort_order . '" data-break="' . $layout_break . '" data-type="' . $post_type . '">';
         // Create Individual Post Output
         $postCounter = 0;
         $postCategories = array();
         $categoriesCount = 0;
         if (post_type_exists($post_type) && $loop->have_posts()) {
             $products .= '<div class="ts-timeline-content">';
             $products .= '<ul id="ts-isotope-posts-grid-' . $postsgrid_random . '" class="ts-isotope-posts-grid ts-timeline-list" data-layout="' . $layout . '" data-key="' . $postsgrid_random . '">';
             while ($loop->have_posts()) {
                 $loop->the_post();
                 $postCounter++;
                 $product_id = get_the_ID();
                 $product_title = get_the_title($product_id);
                 $post = get_post($product_id);
                 $product = new WC_Product($product_id);
                 $attachment_ids = $product->get_gallery_attachment_ids();
                 $price = $product->get_price_html();
                 $product_sku = $product->get_sku();
                 $attributes = $product->get_attributes();
                 $stock = $product->is_in_stock() ? 'true' : 'false';
                 $onsale = $product->is_on_sale() ? 'true' : 'false';
                 // Rating Settings
                 $rating_html = $product->get_rating_html();
                 $rating = $product->get_average_rating();
                 if ($rating == '') {
                     $rating = 0;
                 }
                 if ($rating_quarter == "true") {
                     $rating_value = floor($rating * 4) / 4;
                 } else {
                     $rating_value = $rating;
                 }
                 $rating_value = number_format($rating_value, 2, $caption_digits, '');
                 if ($rating_rtl == "false") {
                     $rating_width = $rating_value / $rating_maximum * 100;
                 } else {
                     $rating_width = 100 - $rating_value / $rating_maximum * 100;
                 }
                 if ($rating_symbol == "other") {
                     if ($rating_icon == "ts-ecommerce-starfull1") {
                         $rating_class = 'ts-rating-stars-star1';
                     } else {
                         if ($rating_icon == "ts-ecommerce-starfull2") {
                             $rating_class = 'ts-rating-stars-star2';
                         } else {
                             if ($rating_icon == "ts-ecommerce-starfull3") {
                                 $rating_class = 'ts-rating-stars-star3';
                             } else {
                                 if ($rating_icon == "ts-ecommerce-starfull4") {
                                     $rating_class = 'ts-rating-stars-star4';
                                 } else {
                                     if ($rating_icon == "ts-ecommerce-heartfull") {
                                         $rating_class = 'ts-rating-stars-heart1';
                                     } else {
                                         if ($rating_icon == "ts-ecommerce-heart") {
开发者ID:ryansm,项目名称:saud,代码行数:67,代码来源:ts_vcsc_woocommerce_custom_grid.php

示例4: extract


//.........这里部分代码省略.........
     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>';
     }
     // Add Navigation Controls
     if ($frontend_edit == "false") {
         $output .= '<div id="ts-owlslider-controls-' . $woo_random . '" class="ts-owlslider-controls" style="' . ($auto_play == "true" || $show_navigation == "true" ? "display: block;" : "display: none;") . '">';
         $output .= '<div id="ts-owlslider-controls-next-' . $woo_random . '" style="' . ($show_navigation == "true" ? "display: block;" : "display: none;") . '" class="ts-owlslider-controls-next"><span class="ts-ecommerce-arrowright5"></span></div>';
         $output .= '<div id="ts-owlslider-controls-prev-' . $woo_random . '" style="' . ($show_navigation == "true" ? "display: block;" : "display: none;") . '" class="ts-owlslider-controls-prev"><span class="ts-ecommerce-arrowleft5"></span></div>';
         if ($auto_play == "true") {
             $output .= '<div id="ts-owlslider-controls-play-' . $woo_random . '" class="ts-owlslider-controls-play active"><span class="ts-ecommerce-pause"></span></div>';
         }
         $output .= '</div>';
     }
     // Front-Edit Message
     if ($frontend_edit == "true") {
         $output .= $slider_message;
     }
     // Add Slider
     $output .= '<div id="' . $woo_slider_id . '" class="' . $css_class . '" style="margin-top: ' . $margin_top . 'px; margin-bottom: ' . $margin_bottom . 'px;" data-id="' . $woo_random . '" data-items="' . $products_slide . '" data-breakpointscustom="' . $breakpoints_custom . '" data-breakpointitems="' . $breakpoints_items . '" data-rtl="' . $page_rtl . '" data-loop="' . $items_loop . '" data-navigation="' . $show_navigation . '" data-dots="' . $show_dots . '" data-mobile="' . $animation_mobile . '" data-animationin="' . $animation_in . '" data-animationout="' . $animation_out . '" data-height="' . $auto_height . '" data-play="' . $auto_play . '" data-bar="' . $show_bar . '" data-color="' . $bar_color . '" data-speed="' . $show_speed . '" data-hover="' . $stop_hover . '">';
     if ($loop->have_posts()) {
         while ($loop->have_posts()) {
             $loop->the_post();
             $product_id = get_the_ID();
             $product_title = get_the_title($product_id);
             $post = get_post($product_id);
             $product = new WC_Product($product_id);
             $attachment_ids = $product->get_gallery_attachment_ids();
             $price = $product->get_price_html();
             $product_sku = $product->get_sku();
             $attributes = $product->get_attributes();
             $stock = $product->is_in_stock() ? 'true' : 'false';
             $onsale = $product->is_on_sale() ? 'true' : 'false';
             // Rating Settings
             $rating_html = $product->get_rating_html();
             $rating = $product->get_average_rating();
             if ($rating == '') {
                 $rating = 0;
             }
             if ($rating_quarter == "true") {
                 $rating_value = floor($rating * 4) / 4;
             } else {
                 $rating_value = $rating;
             }
             $rating_value = number_format($rating_value, 2, $caption_digits, '');
             if ($rating_rtl == "false") {
                 $rating_width = $rating_value / $rating_maximum * 100;
             } else {
                 $rating_width = 100 - $rating_value / $rating_maximum * 100;
             }
             if ($rating_symbol == "other") {
                 if ($rating_icon == "ts-ecommerce-starfull1") {
                     $rating_class = 'ts-rating-stars-star1';
                 } else {
                     if ($rating_icon == "ts-ecommerce-starfull2") {
                         $rating_class = 'ts-rating-stars-star2';
                     } else {
                         if ($rating_icon == "ts-ecommerce-starfull3") {
                             $rating_class = 'ts-rating-stars-star3';
                         } else {
                             if ($rating_icon == "ts-ecommerce-starfull4") {
                                 $rating_class = 'ts-rating-stars-star4';
                             } else {
                                 if ($rating_icon == "ts-ecommerce-heartfull") {
                                     $rating_class = 'ts-rating-stars-heart1';
                                 } else {
                                     if ($rating_icon == "ts-ecommerce-heart") {
开发者ID:Telemedellin,项目名称:fonvalmed,代码行数:67,代码来源:ts_vcsc_woocommerce_custom_slider.php

示例5: WooComposer_Single_style03

function WooComposer_Single_style03($atts)
{
    $product_id = $product_style = $display_elements = $img_animate = $text_align = $color_heading = $color_categories = $color_price = '';
    $color_rating = $color_rating_bg = $color_quick_bg = $color_quick = $color_cart_bg = $color_cart = $color_product_desc = '';
    $color_product_desc_bg = $size_title = $size_cat = $size_price = $color_on_sale = $color_on_sale_bg = $label_on_sale = $border_style = '';
    $border_color = $border_size = $border_radius = $sale_price = $on_sale_alignment = $on_sale_style = $product_img_disp = '';
    extract(shortcode_atts(array("product_id" => "", "product_style" => "style01", "display_elements" => "", "label_on_sale" => "Sale!", "text_align" => "left", "img_animate" => "rotate-clock", "color_heading" => "", "color_categories" => "", "color_price" => "", "color_rating" => "", "color_rating_bg" => "", "color_quick_bg" => "", "color_quick" => "", "color_cart_bg" => "", "color_on_sale_bg" => "", "color_on_sale" => "", "color_cart" => "", "color_product_desc" => "", "color_product_desc_bg" => "", "size_title" => "", "size_cat" => "", "size_price" => "", "border_style" => "", "border_color" => "", "border_size" => "", "border_radius" => "", "sale_price" => "", "on_sale_style" => "wcmp-sale-circle", "on_sale_alignment" => "wcmp-sale-right", "product_img_disp" => "single"), $atts));
    $output = $heading_style = $cat_style = $price_style = $cart_style = $cart_bg_style = $view_style = $view_bg_style = $rating_style = '';
    $desc_style = $label_style = $border = $desc_style = $sale_price_size = '';
    $image_size = apply_filters('single_product_large_thumbnail_size', 'shop_single');
    if ($sale_price !== '') {
        $sale_price_size = 'font-size:' . $sale_price . 'px;';
    }
    $img_animate = 'wcmp-img-' . $img_animate;
    if ($border_style !== '') {
        $border .= 'border:' . $border_size . 'px ' . $border_style . ' ' . $border_color . ';';
        $border .= 'border-radius:' . $border_radius . 'px;';
    }
    if ($color_product_desc_bg !== '') {
        $desc_style .= 'background:' . $color_product_desc_bg . ';';
    }
    if ($color_product_desc !== '') {
        $desc_style .= 'color:' . $color_product_desc . ';';
    }
    if ($color_heading !== "") {
        $heading_style = 'color:' . $color_heading . ';';
    }
    if ($size_title !== "") {
        $heading_style .= 'font-size:' . $size_title . 'px;';
    }
    if ($color_categories !== "") {
        $cat_style = 'color:' . $color_categories . ';';
    }
    if ($size_cat !== "") {
        $cat_style .= 'font-size:' . $size_cat . 'px;';
    }
    if ($color_price !== "") {
        $price_style = 'color:' . $color_price . ';';
    }
    if ($size_price !== "") {
        $price_style .= 'font-size:' . $size_price . 'px;';
    }
    if ($color_rating !== "") {
        $rating_style .= 'color:' . $color_rating . ';';
    }
    if ($color_rating_bg !== "") {
        $rating_style .= 'background:' . $color_rating_bg . ';';
    }
    if ($color_quick_bg !== "") {
        $view_bg_style = 'background:' . $color_quick_bg . ';';
    }
    if ($color_quick !== "") {
        $view_style = 'color:' . $color_quick . ';';
    }
    if ($color_cart_bg !== "") {
        $cart_bg_style = 'background:' . $color_cart_bg . ';';
    }
    if ($color_cart !== "") {
        $cart_style = 'color:' . $color_cart . ';';
    }
    if ($color_on_sale_bg !== "") {
        $label_style = 'background:' . $color_on_sale_bg . ';';
    }
    if ($color_on_sale !== "") {
        $label_style .= 'color:' . $color_on_sale . ';';
    }
    $elemets = explode(",", $display_elements);
    $product_title = get_the_title($product_id);
    $post = get_post($product_id);
    $product_desc = get_post($product_id)->post_excerpt;
    $product_img = wp_get_attachment_image_src(get_post_thumbnail_id($product_id), $image_size);
    $product = new WC_Product($product_id);
    $attachment_ids = $product->get_gallery_attachment_ids();
    $price = $product->get_price_html();
    $rating = $product->get_rating_html();
    $attributes = $product->get_attributes();
    $stock = $product->is_in_stock() ? 'InStock' : 'OutOfStock';
    if ($product->is_on_sale()) {
        $on_sale = apply_filters('woocommerce_sale_flash', $label_on_sale, $post, $product);
    } else {
        $on_sale = '';
    }
    $cat_count = sizeof(get_the_terms($product_id, 'product_cat'));
    $tag_count = sizeof(get_the_terms($product_id, 'product_tag'));
    $categories = $product->get_categories(', ', '<span class="posted_in">' . _n('', '', $cat_count, 'woocommerce') . ' ', '.</span>');
    $tags = $product->get_tags(', ', '<span class="tagged_as">' . _n('', '', $tag_count, 'woocommerce') . ' ', '.</span>');
    $output .= "\n" . '<div class="wcmp-product woocommerce wcmp-' . $product_style . ' ' . $img_animate . '" style="' . $border . ' ' . $desc_style . '">';
    $output .= "\n\t" . '<div class="wcmp-product-image">';
    if (!empty($attachment_ids) && count($attachment_ids) > 1 && $product_img_disp == "carousel") {
        $uniqid = uniqid();
        $output .= '<div class="wcmp-single-image-carousel">';
        $product_img = wp_get_attachment_image_src(get_post_thumbnail_id($product_id), $image_size);
        $src = $product_img[0];
        $output .= '<div><div class="wcmp-image"><img class="wcmp-img" src="' . $src . '" data-src="' . $product_img[0] . '"/></div></div>';
        foreach ($attachment_ids as $attachment_id) {
            $product_img = wp_get_attachment_image_src($attachment_id, $image_size);
            $output .= '<div><div class="wcmp-image"><img class="wcmp-img" src="' . $src . '" data-src="' . $product_img[0] . '"/></div></div>';
        }
        $output .= '</div>';
    } else {
//.........这里部分代码省略.........
开发者ID:RDePoppe,项目名称:luminaterealestate,代码行数:101,代码来源:design-single-style03.php

示例6: shop_isle_products_slider_on_single_page

/**
 * Products slider on single page product
 * @since  1.0.0
 */
function shop_isle_products_slider_on_single_page()
{
    global $wp_customize;
    $shop_isle_products_slider_single_hide = get_theme_mod('shop_isle_products_slider_single_hide');
    if (isset($shop_isle_products_slider_single_hide) && $shop_isle_products_slider_single_hide != 1) {
        echo '<hr class="divider-w">';
        echo '<section class="module module-small-bottom aya">';
    } elseif (isset($wp_customize)) {
        echo '<hr class="divider-w">';
        echo '<section class="module module-small-bottom shop_isle_hidden_if_not_customizer">';
    }
    if (isset($shop_isle_products_slider_single_hide) && $shop_isle_products_slider_single_hide != 1 || isset($wp_customize)) {
        echo '<div class="container">';
        $shop_isle_products_slider_title = get_theme_mod('shop_isle_products_slider_title', __('Exclusive products', 'shop-isle'));
        $shop_isle_products_slider_subtitle = get_theme_mod('shop_isle_products_slider_subtitle', __('Special category of products', 'shop-isle'));
        if (!empty($shop_isle_products_slider_title) || !empty($shop_isle_products_slider_subtitle)) {
            echo '<div class="row">';
            echo '<div class="col-sm-6 col-sm-offset-3">';
            if (!empty($shop_isle_products_slider_title)) {
                echo '<h2 class="module-title font-alt">' . $shop_isle_products_slider_title . '</h2>';
            }
            if (!empty($shop_isle_products_slider_subtitle)) {
                echo '<div class="module-subtitle font-serif">' . $shop_isle_products_slider_subtitle . '</div>';
            }
            echo '</div>';
            echo '</div><!-- .row -->';
        }
        $shop_isle_products_slider_category = get_theme_mod('shop_isle_products_slider_category');
        if (!empty($shop_isle_products_slider_category) && $shop_isle_products_slider_category != '-') {
            $shop_isle_products_slider_args = array('post_type' => 'product', 'posts_per_page' => 10, 'tax_query' => array(array('taxonomy' => 'product_cat', 'field' => 'term_id', 'terms' => $shop_isle_products_slider_category)));
            $shop_isle_products_slider_loop = new WP_Query($shop_isle_products_slider_args);
            if ($shop_isle_products_slider_loop->have_posts()) {
                echo '<div class="row">';
                echo '<div class="owl-carousel text-center" data-items="5" data-pagination="false" data-navigation="false">';
                while ($shop_isle_products_slider_loop->have_posts()) {
                    $shop_isle_products_slider_loop->the_post();
                    echo '<div class="owl-item">';
                    echo '<div class="col-sm-12">';
                    echo '<div class="ex-product">';
                    echo '<a href="' . get_permalink() . '">' . woocommerce_get_product_thumbnail() . '</a>';
                    echo '<h4 class="shop-item-title font-alt"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h4>';
                    $product = new WC_Product(get_the_ID());
                    $rating_html = $product->get_rating_html($product->get_average_rating());
                    if ($rating_html && get_option('woocommerce_enable_review_rating') === 'yes') {
                        echo '<div class="product-rating-home">' . $rating_html . '</div>';
                    }
                    if (!empty($product)) {
                        if (function_exists('get_woocommerce_price_format')) {
                            $format_string = get_woocommerce_price_format();
                        }
                        if (!empty($format_string)) {
                            switch ($format_string) {
                                case '%1$s%2$s':
                                    echo get_woocommerce_currency_symbol() . $product->price;
                                    break;
                                case '%2$s%1$s':
                                    echo $product->price . get_woocommerce_currency_symbol();
                                    break;
                                case '%1$s&nbsp;%2$s':
                                    echo get_woocommerce_currency_symbol() . ' ' . $product->price;
                                    break;
                                case '%2$s&nbsp;%1$s':
                                    echo $product->price . ' ' . get_woocommerce_currency_symbol();
                                    break;
                            }
                        } else {
                            echo get_woocommerce_currency_symbol() . $product->price;
                        }
                    }
                    echo '</div>';
                    echo '</div>';
                    echo '</div>';
                }
                wp_reset_postdata();
                echo '</div>';
                echo '</div>';
            }
        } else {
            $shop_isle_products_slider_args = array('post_type' => 'product', 'posts_per_page' => 10);
            $shop_isle_products_slider_loop = new WP_Query($shop_isle_products_slider_args);
            if ($shop_isle_products_slider_loop->have_posts()) {
                echo '<div class="row">';
                echo '<div class="owl-carousel text-center" data-items="5" data-pagination="false" data-navigation="false">';
                while ($shop_isle_products_slider_loop->have_posts()) {
                    $shop_isle_products_slider_loop->the_post();
                    echo '<div class="owl-item">';
                    echo '<div class="col-sm-12">';
                    echo '<div class="ex-product">';
                    echo '<a href="' . get_permalink() . '">' . woocommerce_get_product_thumbnail() . '</a>';
                    echo '<h4 class="shop-item-title font-alt"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h4>';
                    $product = new WC_Product(get_the_ID());
                    $rating_html = $product->get_rating_html($product->get_average_rating());
                    if ($rating_html && get_option('woocommerce_enable_review_rating') === 'yes') {
                        echo '<div class="product-rating-home">' . $rating_html . '</div>';
                    }
                    if (!empty($product)) {
//.........这里部分代码省略.........
开发者ID:sucun21,项目名称:Ginseng,代码行数:101,代码来源:functions.php

示例7: extract


//.........这里部分代码省略.........
                $output .= '<div class="ts-newsticker-elements-frame ' . $newsticker_elements . ' ' . $ticker_border_radius . '" style="">';
                // Add Navigation Controls
                $output .= '<div id="ts-newsticker-controls-' . $woo_random . '" class="ts-newsticker-controls" style="' . ($ticker_controls == "true" ? "display: block;" : "display: none;") . ' ' . $newsticker_controls . '">';
                $output .= '<div id="ts-newsticker-controls-next-' . $woo_random . '" style="' . ($ticker_controls == "true" ? "display: block;" : "display: none;") . '" class="ts-newsticker-controls-next"><span class="ts-ecommerce-arrowright5"></span></div>';
                $output .= '<div id="ts-newsticker-controls-prev-' . $woo_random . '" style="' . ($ticker_controls == "true" ? "display: block;" : "display: none;") . '" class="ts-newsticker-controls-prev"><span class="ts-ecommerce-arrowleft5"></span></div>';
                $output .= '<div id="ts-newsticker-controls-stop-' . $woo_random . '" class="ts-newsticker-controls-play" style="' . ($ticker_auto == "true" ? "display: block;" : "display: none;") . '"><span class="ts-ecommerce-pause"></span></div>';
                $output .= '<div id="ts-newsticker-controls-play-' . $woo_random . '" class="ts-newsticker-controls-play" style="' . ($ticker_auto == "true" ? "display: none;" : "display: block;") . '"><span class="ts-ecommerce-play"></span></div>';
                $output .= '</div>';
                if ($ticker_side == "left" && $ticker_title == "true") {
                    $output .= '<div id="ts-newsticker-header-' . $woo_random . '" class="header ' . $ticker_border_radius . '" style="background: ' . $ticker_background . '; color: ' . $ticker_color . '; left: 0;">';
                    if ($ticker_icon != '' && $ticker_icon != 'transparent' && $ticker_symbol == "true") {
                        $output .= '<i class="ts-font-icon ' . $ticker_icon . '" style="color: ' . $ticker_paint . '"></i>';
                    }
                    $output .= '<span>' . $ticker_header . '</span>';
                    $output .= '</div>';
                }
                $output .= '<ul id="ts-newsticker-ticker-' . $woo_random . '" class="newsticker ' . $ticker_border_radius . '" style="' . $newsticker_header . '">';
                while ($loop->have_posts()) {
                    $loop->the_post();
                    $postCounter++;
                    if ($postCounter < $posts_limit + 1) {
                        $postAttributes = 'data-full="' . get_post_time($date_format) . '" data-time="' . get_post_time($time_format) . '" data-author="' . get_the_author() . '" data-date="' . get_post_time('U') . '" data-modified="' . get_the_modified_time('U') . '" data-title="' . get_the_title() . '" data-comments="' . get_comments_number() . '" data-id="' . get_the_ID() . '"';
                        $product_id = get_the_ID();
                        $product_title = get_the_title($product_id);
                        $post = get_post($product_id);
                        $product = new WC_Product($product_id);
                        $attachment_ids = $product->get_gallery_attachment_ids();
                        $price = $product->get_price_html();
                        $product_sku = $product->get_sku();
                        $attributes = $product->get_attributes();
                        $stock = $product->is_in_stock() ? 'true' : 'false';
                        $onsale = $product->is_on_sale() ? 'true' : 'false';
                        // Rating Settings
                        $rating_html = $product->get_rating_html();
                        $rating = $product->get_average_rating();
                        if ($rating == '') {
                            $rating = 0;
                        }
                        if ($rating_quarter == "true") {
                            $rating_value = floor($rating * 4) / 4;
                        } else {
                            $rating_value = $rating;
                        }
                        $rating_value = number_format($rating_value, 2, $caption_digits, '');
                        if ($rating_rtl == "false") {
                            $rating_width = $rating_value / $rating_maximum * 100;
                        } else {
                            $rating_width = 100 - $rating_value / $rating_maximum * 100;
                        }
                        if ($rating_symbol == "other") {
                            if ($rating_icon == "ts-ecommerce-starfull1") {
                                $rating_class = 'ts-rating-stars-star1';
                            } else {
                                if ($rating_icon == "ts-ecommerce-starfull2") {
                                    $rating_class = 'ts-rating-stars-star2';
                                } else {
                                    if ($rating_icon == "ts-ecommerce-starfull3") {
                                        $rating_class = 'ts-rating-stars-star3';
                                    } else {
                                        if ($rating_icon == "ts-ecommerce-starfull4") {
                                            $rating_class = 'ts-rating-stars-star4';
                                        } else {
                                            if ($rating_icon == "ts-ecommerce-heartfull") {
                                                $rating_class = 'ts-rating-stars-heart1';
                                            } else {
                                                if ($rating_icon == "ts-ecommerce-heart") {
开发者ID:baochung26,项目名称:happy-c,代码行数:67,代码来源:ts_vcsc_woocommerce_custom_ticker.php

示例8:

        ?>
                                </div>

                                <div class="product-meta">
                                    <div class="name">
                                        <a href="<?php 
        echo esc_url(get_permalink($product->id));
        ?>
"><?php 
        echo $product->get_title();
        ?>
</a>
                                    </div>
                                    <div class="rating clearfix ">
                                        <?php 
        if ($rating_html = $product->get_rating_html()) {
            ?>
                                            <div><?php 
            echo $rating_html;
            ?>
</div>
                                        <?php 
        } else {
            ?>
                                            <div class="star-rating"></div>
                                        <?php 
        }
        ?>
                                    </div>
                                    <div class="price"><?php 
        echo $product->get_price_html();
开发者ID:shubham79,项目名称:Jhintaak,代码行数:31,代码来源:wpo_product_deals.php

示例9: array

 /**
  * Search products
  *
  * @since 1.0
  */
 function instance_search_result()
 {
     check_ajax_referer('_bigboom_nonce', 'bbnonce');
     $args = array('post_type' => 'product', 'posts_per_page' => 30, 's' => trim($_POST['term']));
     if (isset($_POST['cat']) && $_POST['cat'] != '0') {
         $args['product_cat'] = $_POST['cat'];
     }
     $products = new WP_Query($args);
     $response = array();
     if ($products->have_posts()) {
         while ($products->have_posts()) {
             $products->the_post();
             $product = new WC_Product($products->post);
             $response[] = array('label' => get_the_title(), 'value' => get_permalink(), 'price' => $product->get_price_html(), 'rate' => $product->get_rating_html(), 'thumb' => get_the_post_thumbnail(get_the_ID(), 'shop_thumbnail'));
         }
     }
     if (empty($response)) {
         $response[] = array('label' => __('Nothing found', 'bigboom'), 'value' => '#', 'price' => '', 'rate' => '', 'thumb' => '');
     }
     wp_send_json_success($response);
     die;
 }
开发者ID:Qualitair,项目名称:ecommerce,代码行数:27,代码来源:product-search.php

示例10: extract

 function TS_VCSC_WooCommerce_Rating_Basic_Function($atts, $content = null)
 {
     global $VISUAL_COMPOSER_EXTENSIONS;
     global $product;
     global $woocommerce;
     ob_start();
     if ($VISUAL_COMPOSER_EXTENSIONS->TS_VCSC_LoadFrontEndForcable == "false") {
         wp_enqueue_style('ts-extend-simptip');
         wp_enqueue_style('ts-font-ecommerce');
         wp_enqueue_style('ts-visual-composer-extend-front');
         wp_enqueue_script('ts-visual-composer-extend-front');
     }
     extract(shortcode_atts(array('best_rated' => 'false', 'id' => '', 'rating_maximum' => 5, 'rating_size' => 24, 'rating_quarter' => 'true', 'rating_title' => 'true', 'rating_auto' => 'true', 'rating_position' => 'top', 'rating_rtl' => 'false', 'rating_symbol' => 'other', 'rating_icon' => '', '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', 'title_size' => 24, 'title_truncate' => 'true', 'use_name' => 'true', 'custom_title' => '', 'show_cart' => 'true', 'cart_color' => '#cccccc', 'show_link' => 'true', 'link_color' => '#cccccc', 'tooltip_css' => 'false', 'tooltip_content' => '', 'tooltip_position' => 'ts-simptip-position-top', 'tooltip_style' => '', 'margin_top' => 20, 'margin_bottom' => 20, 'el_id' => '', 'el_class' => '', 'css' => ''), $atts));
     // Final Query Arguments
     add_filter('posts_clauses', array(WC()->query, 'order_by_rating_post_clauses'));
     $meta_query = WC()->query->get_meta_query();
     $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => -1, 'orderby' => 'date', 'order' => 'desc', 'paged' => 1, 'meta_query' => $meta_query);
     $loop = new WP_Query($args);
     if ($loop->have_posts()) {
         $best_rating = 0;
         while ($loop->have_posts()) {
             $loop->the_post();
             $product_id = get_the_ID();
             $product = new WC_Product($product_id);
             if ($product_id == $id) {
                 $product_title = get_the_title($product_id);
                 $post = get_post($product_id);
                 $product = new WC_Product($product_id);
                 $attachment_ids = $product->get_gallery_attachment_ids();
                 $price = $product->get_price_html();
                 $product_sku = $product->get_sku();
                 $attributes = $product->get_attributes();
                 $stock = $product->is_in_stock() ? 'true' : 'false';
                 $onsale = $product->is_on_sale() ? 'true' : 'false';
                 $link = get_permalink();
                 // Rating Settings
                 $rating_html = $product->get_rating_html();
                 $rating = $product->get_average_rating();
                 if ($rating == '') {
                     $rating = 0;
                 }
                 if ($rating_quarter == "true") {
                     $rating_value = floor($rating * 4) / 4;
                 } else {
                     $rating_value = $rating;
                 }
                 $rating_value = number_format($rating_value, 2, $caption_digits, '');
                 break;
             }
         }
     }
     wp_reset_postdata();
     wp_reset_query();
     if ($rating_title == "true") {
         if ($use_name == "true") {
             $rating_title = $product_title;
         } else {
             $rating_title = $custom_title;
         }
     } else {
         $rating_title = '';
     }
     if ($rating_rtl == "false") {
         $rating_width = $rating_value / $rating_maximum * 100;
     } else {
         $rating_width = 100 - $rating_value / $rating_maximum * 100;
     }
     if ($rating_symbol == "other") {
         if ($rating_icon == "ts-ecommerce-starfull1") {
             $rating_class = 'ts-rating-stars-star1';
         } else {
             if ($rating_icon == "ts-ecommerce-starfull2") {
                 $rating_class = 'ts-rating-stars-star2';
             } else {
                 if ($rating_icon == "ts-ecommerce-starfull3") {
                     $rating_class = 'ts-rating-stars-star3';
                 } else {
                     if ($rating_icon == "ts-ecommerce-starfull4") {
                         $rating_class = 'ts-rating-stars-star4';
                     } else {
                         if ($rating_icon == "ts-ecommerce-heartfull") {
                             $rating_class = 'ts-rating-stars-heart1';
                         } else {
                             if ($rating_icon == "ts-ecommerce-heart") {
                                 $rating_class = 'ts-rating-stars-heart2';
                             } else {
                                 if ($rating_icon == "ts-ecommerce-thumbsup") {
                                     $rating_class = 'ts-rating-stars-thumb';
                                 } else {
                                     if ($rating_icon == "ts-ecommerce-ribbon4") {
                                         $rating_class = 'ts-rating-stars-ribbon';
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     } else {
//.........这里部分代码省略.........
开发者ID:ryansm,项目名称:saud,代码行数:101,代码来源:ts_vcsc_woocommerce_custom_rating.php


注:本文中的WC_Product::get_rating_html方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。