本文整理汇总了PHP中woocommerce_template_loop_price函数的典型用法代码示例。如果您正苦于以下问题:PHP woocommerce_template_loop_price函数的具体用法?PHP woocommerce_template_loop_price怎么用?PHP woocommerce_template_loop_price使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了woocommerce_template_loop_price函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dokan_product_loop_price
/**
* Renders item-bar of products in the loop
*
* @global WC_Product $product
*/
function dokan_product_loop_price()
{
global $product;
?>
<span class="item-bar">
<?php
woocommerce_template_loop_price();
?>
<span class="item-button">
<?php
woocommerce_template_loop_add_to_cart();
?>
<?php
if (function_exists('dokan_add_to_wishlist_link')) {
dokan_add_to_wishlist_link();
}
?>
</span>
</span>
<?php
}
示例2: show_desc
/**
* Product loop desc
*/
function show_desc()
{
echo '<div class="product-item__desc">';
echo woocommerce_template_loop_product_title();
echo woocommerce_template_loop_price();
echo '</div>';
}
示例3: waxom_woocommerce_product_details
function waxom_woocommerce_product_details()
{
echo '<div class="vntd-product-excerpt">';
echo waxom_excerpt(20, false);
echo '</div>';
echo '<div class="vntd-product-details btn btn-style-default btn-dark btn-icon accent-hover-bg"><i class="fa fa-file-text-o"></i>' . esc_html__('View Details', 'waxom') . '</div>';
echo '<div class="vntd-product-price">';
woocommerce_template_loop_price();
echo '<div class="vntd-product-rating">';
woocommerce_template_loop_rating();
echo '</div>';
echo '</div>';
echo '</div>';
// End details
}
示例4: thb_loop_product_end
function thb_loop_product_end()
{
global $post, $product;
$size = sizeof(get_the_terms($post->ID, 'product_cat'));
echo $product->get_categories(', ', '<span class="posted_in">' . _n('', '', $size, 'woocommerce') . ' ', '</span>');
woocommerce_template_loop_rating();
echo '<div class="thb-add-to-cart-wrapper">';
woocommerce_template_loop_price();
woocommerce_template_loop_add_to_cart();
echo "</div>";
echo "</div>";
}
示例5: dt_woocommerce_shop_overview_extra_div_close
function dt_woocommerce_shop_overview_extra_div_close() {
global $product;
$link = apply_filters( 'out_of_stock_add_to_cart_url', get_permalink( $product->id ) );
ob_start();
woocommerce_template_loop_price();
$price = ob_get_clean();
ob_start();
woocommerce_template_loop_add_to_cart();
$add_to_cart = ob_get_clean();
if( !empty($add_to_cart) ) {
$add_to_cart = str_replace(' class="',' class="small button ',$add_to_cart);
}
echo " <div class='product-details'>";
echo $price;
echo " <div class='product-buttons'>";
echo $add_to_cart;
if ( shortcode_exists( 'yith_wcwl_add_to_wishlist' ) )
echo do_shortcode('[yith_wcwl_add_to_wishlist]');
echo " </div>";
echo " </div>";
echo ' </div>';
echo '</div>';
}
示例6: grve_woo_after_shop_loop_item
/**
* Function to add after shop loop item
*/
function grve_woo_after_shop_loop_item()
{
?>
<div class="grve-product-options">
<?php
woocommerce_template_loop_rating();
?>
<?php
woocommerce_template_loop_add_to_cart();
?>
</div>
</div>
<div class="grve-product-content">
<span class="grve-product-name"><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></span>
<span class="grve-product-price"><?php
woocommerce_template_loop_price();
?>
</span>
</div>
</div>
<?php
}
示例7: content
protected function content($atts, $content = null)
{
$class_col = null;
extract(shortcode_atts(array('num_cols' => '2', 'num_posts' => '12', 'products_type' => '1', 'slugs' => 'web-design,logo-design,illustration'), $atts));
// $width_class = '';
// $css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $width_class, $this->settings['base'], $atts );
switch ($num_cols) {
case '2':
$class_col = 'two_col';
break;
case '3':
$class_col = 'three_col';
break;
case '4':
$class_col = 'four_col';
break;
default:
$class_col = 'four_col';
break;
}
$args = array('post_type' => 'product', 'posts_per_page' => $num_posts);
if ($products_type == '2') {
$args = array('post_type' => 'product', 'posts_per_page' => $num_posts, 'meta_query' => array('relation' => 'OR', array('key' => '_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'numeric'), array('key' => '_min_variation_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'numeric')));
}
if ($products_type == '3') {
$args = array('post_type' => 'product', 'meta_key' => '_featured', 'meta_value' => 'yes', 'posts_per_page' => $num_posts);
}
if ($products_type == '4') {
$cat_slugs = explode(',', $slugs);
$args = array('posts_per_page' => $num_posts, 'tax_query' => array('relation' => 'AND', array('taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => $cat_slugs)), 'post_type' => 'product');
}
ob_start();
?>
<div class="framed_wrapper_products">
<?php
$products_loop = new WP_Query($args);
if ($products_loop->have_posts()) {
while ($products_loop->have_posts()) {
$products_loop->the_post();
global $product, $post;
$cat_count = sizeof(get_the_terms($post->ID, 'product_cat'));
$attachment_id = $product->get_gallery_attachment_ids();
?>
<div class="framed_woo_product <?php
echo esc_attr($class_col);
?>
">
<div class="framed_img">
<a href="<?php
the_permalink();
?>
">
<?php
/**
* woocommerce_before_shop_loop_item_title hook
*
* @hooked woocommerce_show_product_loop_sale_flash - 10
* @hooked woocommerce_template_loop_product_thumbnail - 10
*/
do_action('woocommerce_before_shop_loop_item_title');
?>
</a>
</div>
<div class="framed_wrap_content">
<div>
<?php
echo apply_filters('woocommerce_loop_add_to_cart_link', sprintf('<a href="%s" rel="nofollow" data-product_id="%s" data-product_sku="%s" data-quantity="%s" class="button %s product_type_%s">%s</a>', esc_url($product->add_to_cart_url()), esc_attr($product->id), esc_attr($product->get_sku()), esc_attr(isset($quantity) ? $quantity : 1), $product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '', esc_attr($product->product_type), esc_html($product->add_to_cart_text())), $product);
?>
<a href="<?php
the_permalink();
?>
"><?php
_e('View More', THEME_NAME);
?>
</a>
</div>
<div class="framed_content">
<div>
<h3><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h3>
<p><?php
echo apply_filters('the_content', $product->get_categories(', ', '<span class="posted_in">' . _n('', '', $cat_count, 'woocommerce') . ' ', '.</span>'));
?>
</p>
</div>
<div>
<?php
woocommerce_template_loop_price();
?>
</div>
</div>
</div>
</div>
//.........这里部分代码省略.........
示例8: widget
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', empty($instance['title_popular']) ? __('Hot Products', 'wpdance') : $instance['title_popular']);
$num_popular = empty($instance['num_popular']) ? 5 : absint($instance['num_popular']);
$post_type = "product";
$thumbnail_width = 60;
$thumbnail_height = 60;
$output = $before_widget;
if ($title) {
$output .= $before_title . $title . $after_title;
}
echo $output;
wp_reset_query();
$popular = new wp_query(array('post_type' => 'product', 'posts_per_page' => $num_popular, 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'order' => 'DESC'));
global $post, $product;
?>
<?php
if ($popular->post_count > 0) {
$i = 0;
$id_widget = 'hot_product-' . rand(0, 1000) . time();
?>
<ul class="popular-post-list<?php
echo $id_widget;
?>
">
<?php
while ($popular->have_posts()) {
$popular->the_post();
?>
<li>
<div class="wd_hot_product_wrapper">
<div class="image image-style">
<a class="thumbnail" href="<?php
echo get_permalink($post->ID);
?>
">
<?php
if (has_post_thumbnail()) {
the_post_thumbnail('wd_hot_product', array('title' => esc_attr(get_the_title()), 'alt' => esc_attr(get_the_title())));
}
?>
</a>
<span class="shadow"></span>
</div><!-- .image -->
<?php
$product = get_product($popular->post);
?>
<div class="detail">
<p class="hot_pr_sku"><?php
echo $product->get_sku();
?>
</p>
<p class="title"><a href="<?php
echo get_permalink($post->ID);
?>
"><?php
echo esc_attr(get_the_title($post->ID));
?>
</a></p>
<?php
//the_excerpt();
?>
<?php
woocommerce_template_loop_price();
?>
</div>
</div>
</li>
<?php
}
?>
</ul>
<?php
echo '<div class="clearfix"></div>';
echo '<div class="wd_hot_control"><a class="prev" title="prev" id="wd_hot_product_prev_' . $id_widget . '" href="#"><</a>';
echo '<a class="next" title="next" id="wd_hot_product_next_' . $id_widget . '" href="#" >></a> </div>';
}
?>
<script type="text/javascript" language="javascript">
//<![CDATA[
jQuery(document).ready(function() {
var li_widget = jQuery('.popular-post-list<?php
echo $id_widget;
?>
').parent().parent('li');
var temp_class = '';
if(li_widget.hasClass('first')){
temp_class = '.first';
}
_slider_datas = {
responsive: true
,width : 240
,height : 'auto'
,scroll : {
items : 1,
}
//.........这里部分代码省略.........
示例9: widget
//.........这里部分代码省略.........
$product = wc_get_product($post->ID);
?>
<?php
if ($count % $row == 0) {
?>
<div class="per-slide">
<ul class="product_list_widget">
<?php
}
?>
<li>
<a class="ts-wg-thumbnail" href="<?php
echo esc_url(get_permalink($product->id));
?>
" title="<?php
echo esc_attr($product->get_title());
?>
">
<?php
if ($show_thumbnail) {
if (!$lazy_load) {
echo $product->get_image();
} else {
$image_size = 'shop_thumbnail';
$img_src = '';
$alt = '';
$dimensions = wc_get_image_size($image_size);
if (has_post_thumbnail($product->id)) {
$post_thumbnail_id = get_post_thumbnail_id($product->id);
$image_obj = wp_get_attachment_image_src($post_thumbnail_id, $image_size, 0);
if (isset($image_obj[0])) {
$img_src = $image_obj[0];
}
$alt = trim(strip_tags(get_post_meta($post_thumbnail_id, '_wp_attachment_image_alt', true)));
} else {
if (wc_placeholder_img_src()) {
$img_src = wc_placeholder_img_src();
}
}
echo '<img src="' . esc_url($placeholder_img_src) . '" data-src="' . esc_url($img_src) . '" alt="' . esc_attr($alt) . '" class="attachment-shop_thumbnail wp-post-image ts-lazy-load" width="' . $dimensions['width'] . '" height="' . $dimensions['height'] . '" />';
}
}
?>
</a>
<div class="ts-wg-meta">
<?php
if ($show_categories) {
ts_template_loop_categories();
}
?>
<a href="<?php
echo esc_url(get_permalink($product->id));
?>
" title="<?php
echo esc_attr($product->get_title());
?>
">
<?php
if ($show_product_title) {
echo esc_html($product->get_title());
}
?>
</a>
<?php
if ($show_price) {
woocommerce_template_loop_price();
}
?>
<?php
if ($show_rating) {
woocommerce_template_loop_rating();
}
?>
</div>
</li>
<?php
if ($count % $row == $row - 1 || $count == $num_posts - 1) {
?>
</ul>
</div>
<?php
}
?>
<?php
$count++;
}
?>
</div>
<?php
}
echo $after_widget;
if ($product_type == 'top_rated') {
remove_filter('posts_clauses', array(WC()->query, 'order_by_rating_post_clauses'));
}
wp_reset_postdata();
}
示例10: khore_woocommerce_before_shop_loop_item
function khore_woocommerce_before_shop_loop_item()
{
global $post;
echo '<td class="title">';
do_action('woocommerce_before_shop_loop_item_title');
echo '<h3>' . get_the_title() . '</h3>';
do_action('woocommerce_after_shop_loop_item_title');
echo '</td>';
echo '<td class="description">';
echo '<span class="short-description">' . $post->post_excerpt . '</span>';
echo '</td>';
echo '<td class="price">';
woocommerce_template_loop_price();
echo '</td>';
echo '<td class="quantity">';
woocommerce_quantity_input();
echo '<input type="hidden" name="product_id" value="' . $post->ID . '" />';
echo '</td>';
}
示例11: venedor_featured_products_slider
function venedor_featured_products_slider()
{
$args = array('post_status' => 'publish', 'post_type' => 'product', 'ignore_sticky_posts' => 1, 'meta_key' => '_featured', 'meta_value' => 'yes', 'posts_per_page' => 8, 'orderby' => 'date', 'order' => 'desc', 'product_cat' => get_query_var('product_cat'));
$products = new WP_Query($args);
global $venedor_product_slider;
if ($products->have_posts()) {
?>
<div class="product-featured-slider owl-carousel">
<?php
while ($products->have_posts()) {
$products->the_post();
if (!has_post_thumbnail()) {
continue;
}
?>
<div class="container product-item product"><div class="row">
<div class="col-sm-5">
<?php
venedor_woocommerce_image();
?>
</div>
<div class="col-sm-7 product-details"><div class="inner">
<a href="<?php
the_permalink();
?>
">
<h3 class="product-name"><?php
the_title();
?>
</h3>
</a>
<div class="price-box"><?php
echo woocommerce_template_loop_price();
?>
</div>
<div class="product-desc"><?php
echo venedor_excerpt(50, false);
?>
</div>
<?php
global $product;
if (!$product->is_in_stock()) {
?>
<a href="<?php
echo apply_filters('out_of_stock_add_to_cart_url', get_permalink($product->id));
?>
" class="button"><?php
echo apply_filters('out_of_stock_add_to_cart_text', __('Read More', 'woocommerce'));
?>
</a>
<?php
} else {
$link = array('url' => '', 'label' => '', 'class' => '');
$handler = apply_filters('woocommerce_add_to_cart_handler', $product->product_type, $product);
switch ($handler) {
case "variable":
$link['url'] = apply_filters('variable_add_to_cart_url', get_permalink($product->id));
$link['label'] = apply_filters('variable_add_to_cart_text', __('Select options', 'woocommerce'));
break;
case "grouped":
$link['url'] = apply_filters('grouped_add_to_cart_url', get_permalink($product->id));
$link['label'] = apply_filters('grouped_add_to_cart_text', __('View options', 'venedor'));
break;
case "external":
$link['url'] = apply_filters('external_add_to_cart_url', get_permalink($product->id));
$link['label'] = apply_filters('external_add_to_cart_text', __('Read More', 'woocommerce'));
break;
default:
if ($product->is_purchasable()) {
$link['url'] = apply_filters('add_to_cart_url', esc_url($product->add_to_cart_url()));
$link['label'] = apply_filters('add_to_cart_text', __('Add to cart', 'woocommerce'));
$link['class'] = apply_filters('add_to_cart_class', 'add_to_cart_button');
} else {
$link['url'] = apply_filters('not_purchasable_url', get_permalink($product->id));
$link['label'] = apply_filters('not_purchasable_text', __('Read More', 'woocommerce'));
}
break;
}
echo apply_filters('woocommerce_loop_add_to_cart_link', sprintf('<a href="%s" rel="nofollow" data-product_id="%s" data-product_sku="%s" class="%s cart-links btn btn-lg product_type_%s">%s</a>', esc_url($link['url']), esc_attr($product->id), esc_attr($product->get_sku()), esc_attr($link['class']), esc_attr($product->product_type), esc_html($link['label'])), $product, $link);
}
?>
</div></div>
</div></div>
<?php
}
// end of the loop.
?>
</div>
<script type="text/javascript">
/* <![CDATA[ */
//.........这里部分代码省略.........
示例12: dt_woocommerce_shop_overview_show_price
function dt_woocommerce_shop_overview_show_price()
{
$out = "";
global $product;
ob_start();
woocommerce_template_loop_price();
$price = ob_get_clean();
$out .= "<div class='product-details'>";
$out .= '<h5><a href="' . get_permalink($product->id) . '">' . $product->post->post_title . '</a></h5>';
$out .= '<span class="product-price">' . $price . '</span>';
$out .= '</div>';
echo $out;
}
示例13: lab_wc_product_loop_item_info
function lab_wc_product_loop_item_info()
{
global $woocommerce, $product;
$shop_catalog_layout = get_data('shop_catalog_layout');
$cart_url = $woocommerce->cart->get_cart_url();
$show_price = get_data('shop_product_price_listing');
$shop_product_category = get_data('shop_product_category_listing');
// Full + Transparent Background Layout Type
if (in_array($shop_catalog_layout, array('full-bg', 'transparent-bg'))) {
?>
<div class="item-info">
<h3 <?php
if ($shop_catalog_layout == 'transparent-bg' && $shop_product_category == false) {
?>
class="no-category-present"<?php
}
?>
>
<a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a>
</h3>
<?php
if ($shop_product_category) {
?>
<div class="product-category">
<?php
echo $product->get_categories();
?>
</div>
<?php
}
?>
<div class="product-bottom-details">
<?php
if ($show_price) {
woocommerce_template_loop_price();
}
?>
<?php
woocommerce_template_loop_add_to_cart();
?>
</div>
</div>
<?php
// Centered – Distanced Background Layout Type
} elseif (in_array($shop_catalog_layout, array('distanced-centered'))) {
?>
<div class="item-info">
<div class="title-and-price">
<h3>
<a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a>
</h3>
<?php
if ($show_price) {
woocommerce_template_loop_price();
}
?>
</div>
<?php
woocommerce_template_loop_add_to_cart();
?>
</div>
<?php
} else {
?>
<div class="item-info">
<div class="row custom-margin">
<div class="col-xs-<?php
echo $show_price ? 9 : 12;
?>
">
<h3>
<a href="<?php
//.........这里部分代码省略.........
示例14: content
protected function content($atts, $content = null)
{
$atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('list_product_megamenu', $atts) : $atts;
$atts = shortcode_atts(array('title' => '', 'cat' => 0, 'number' => 4, 'types' => 'sale', 'css_animation' => '', 'el_class' => '', 'css' => ''), $atts);
extract($atts);
global $woocommerce_loop;
$elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'list_product_megamenu', $this->settings['base'], $atts), 'extra' => $this->getExtraClass($el_class), 'css_animation' => $this->getCSSAnimation($css_animation), 'shortcode_custom' => vc_shortcode_custom_css_class($css, ' '));
$elementClass = preg_replace(array('/\\s+/', '/^\\s|\\s$/'), array(' ', ''), implode(' ', $elementClass));
ob_start();
$meta_query = WC()->query->get_meta_query();
$query = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $number, 'meta_query' => $meta_query);
global $woocommerce_loop;
$woocommerce_loop['columns'] = $number;
if ($cat > 0) {
$query['tax_query'] = array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => $cat));
}
if ($types == 'arrival') {
$query['orderby'] = 'date';
$query['order'] = 'DESC';
}
if ($types == 'sale') {
$product_ids_on_sale = wc_get_product_ids_on_sale();
$query['meta_key'] = 'total_sales';
$query['orderby'] = 'meta_value_num';
$query['post__in'] = array_merge(array(0), $product_ids_on_sale);
}
if ($types == 'review') {
add_filter('posts_clauses', array($this, 'order_by_rating_post_clauses'));
}
$products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $query, $atts));
if ($types == 'review') {
remove_filter('posts_clauses', array($this, 'order_by_rating_post_clauses'));
}
$bootstrapColumn = round(12 / $number);
if ($products->have_posts()) {
?>
<div class="mega-group <?php
echo esc_attr($elementClass);
?>
">
<?php
if ($title != "") {
?>
<h4 class="mega-group-header"><span><?php
echo esc_attr($title);
?>
</span></h4>
<?php
}
?>
<div class="mega-products row">
<?php
while ($products->have_posts()) {
$products->the_post();
?>
<?php
global $product;
$rating_count = $product->get_rating_count();
?>
<div class="col-sm-<?php
echo esc_attr($bootstrapColumn);
?>
mega-product">
<div class="product-avatar">
<a href="<?php
the_permalink();
?>
">
<?php
the_post_thumbnail('shop_catalog');
?>
</a>
</div>
<div class="product-name">
<a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a>
</div>
<div class="price-box">
<?php
woocommerce_template_loop_price();
?>
</div>
<?php
echo edo_display_rating($rating_count);
?>
</div>
<?php
}
// end of the loop.
?>
</div>
</div>
<?php
}
return ob_get_clean();
//.........这里部分代码省略.........
示例15: dt_woocommerce_shop_overview_show_price
function dt_woocommerce_shop_overview_show_price()
{
global $product;
ob_start();
woocommerce_template_loop_price();
$price = ob_get_clean();
echo $price;
}