本文整理汇总了PHP中woocommerce_template_loop_add_to_cart函数的典型用法代码示例。如果您正苦于以下问题:PHP woocommerce_template_loop_add_to_cart函数的具体用法?PHP woocommerce_template_loop_add_to_cart怎么用?PHP woocommerce_template_loop_add_to_cart使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了woocommerce_template_loop_add_to_cart函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: zn_add_to_cart
function zn_add_to_cart()
{
ob_start();
woocommerce_template_loop_add_to_cart();
$output = ob_get_clean();
echo '<div class="zn_add_to_cart">' . $output . '</div>';
}
开发者ID:fjbeteiligung,项目名称:development,代码行数:7,代码来源:config.php
示例2: 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
}
开发者ID:StefanBonilla,项目名称:CoupSoup,代码行数:28,代码来源:wc-template.php
示例3: vntd_woocommerce_loop_thumbnail
function vntd_woocommerce_loop_thumbnail()
{
echo '<div class="product-thumbnail-wrap">';
woocommerce_template_loop_product_thumbnail();
echo '<div class="product-overlay-add">';
woocommerce_template_loop_add_to_cart();
echo '</div></div>';
}
开发者ID:jfbelisle,项目名称:magexpress,代码行数:8,代码来源:config.php
示例4: waxom_woocommerce_loop_thumbnail
function waxom_woocommerce_loop_thumbnail()
{
echo '<div class="product-thumbnail-wrap vntd-accent-bg-color">';
woocommerce_template_loop_product_thumbnail();
echo '<div class="product-overlay">';
echo '<div class="product-overlay-inner">';
woocommerce_template_loop_add_to_cart();
echo '</div></div></div>';
echo '<div class="product-details-wrap"><div class="product-category">' . waxom_product_categories() . '</div>';
}
开发者ID:siiiiilvio,项目名称:kadcnc,代码行数:10,代码来源:config.php
示例5: get_the_post_thumbnail
<?php
if (has_post_thumbnail($loop->post->ID)) {
echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog');
} else {
echo '<img src="' . woocommerce_placeholder_img_src() . '" alt="Placeholder" width="300px" height="300px" />';
}
?>
<h3><?php
the_title();
?>
</h3>
<span class="price"><?php
echo $product->get_price_html();
?>
</span>
</a>
<?php
woocommerce_template_loop_add_to_cart($loop->post, $product);
?>
</li>
<?php
}
wp_reset_query();
开发者ID:qnk,项目名称:lessaggs,代码行数:31,代码来源:wc-loop-mainpage.php
示例6: avia_add_cart_button
function avia_add_cart_button()
{
global $product, $avia_config;
if ($product->product_type == 'bundle') {
$product = new WC_Product_Bundle($product->id);
}
$extraClass = "";
ob_start();
woocommerce_template_loop_add_to_cart();
$output = ob_get_clean();
if (!empty($output)) {
$pos = strpos($output, ">");
if ($pos !== false) {
$output = substr_replace($output, "><span " . av_icon_string('cart') . "></span> ", $pos, strlen(1));
}
}
if ($product->product_type == 'variable' && empty($output)) {
$output = '<a class="add_to_cart_button button product_type_variable" href="' . get_permalink($product->id) . '"><span ' . av_icon_string("details") . '></span> ' . __("Select options", "avia_framework") . '</a>';
}
if ($product->product_type == 'simple' || $product->product_type == 'subscription') {
$output .= '<a class="button show_details_button" href="' . get_permalink($product->id) . '"><span ' . av_icon_string("details") . '></span> ' . __("Show Details", "avia_framework") . '</a>';
} else {
$extraClass = "single_button";
}
if (empty($extraClass)) {
$output .= " <span class='button-mini-delimiter'></span>";
}
if ($output && !post_password_required()) {
echo "<div class='avia_cart_buttons {$extraClass}'>{$output}</div>";
}
}
开发者ID:Jiersone,项目名称:mac,代码行数:31,代码来源:config.php
示例7: rd_add_cart_button
function rd_add_cart_button()
{
global $product, $rd_config;
if ($product->product_type == 'bundle') {
$product = new WC_Product_Bundle($product->id);
}
$extraClass = "";
ob_start();
woocommerce_template_loop_add_to_cart();
$output = ob_get_clean();
if (!empty($output)) {
$pos = strpos($output, ">");
if ($pos !== false) {
$output = substr_replace($output, "> ", $pos, strlen(1));
}
}
if ($product->product_type == 'variable' && empty($output)) {
$output = '<a class="add_to_cart_button button product_type_variable" href="' . get_permalink($product->id) . '"> ' . __("Select options", "rd_framework") . '</a>';
}
if (in_array($product->product_type, array('subscription', 'simple', 'bundle'))) {
$output .= '<a class="button show_details_button" href="' . get_permalink($product->id) . '"> ' . __("Show Details", "rd_framework") . '</a>';
}
if (!$product->is_in_stock()) {
$output = '<a href="' . get_permalink() . '" rel="nofollow" class="button add_to_cart_button more_info_button out_stock_button"> ' . __("Out of Stock", "rd_framework") . '</a>';
} else {
$extraClass = "single_button";
}
if (empty($extraClass)) {
$output .= " <span class='button-mini-delimiter'></span>";
}
if ($output && !post_password_required()) {
echo "<div class='custom_cart_button {$extraClass}'>{$output}</div>";
}
}
开发者ID:axelander95,项目名称:wsguiavirtualpichincha,代码行数:34,代码来源:woocommerce-functions-trending.php
示例8: 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));
$out = "";
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="dt-sc-button ', $add_to_cart);
}
$out .= '<!-- Product Details -->';
$out .= "<div class='product-details'>";
$out .= $price;
$out .= $add_to_cart;
$out .= '</div><!-- Product Details -->';
$out .= '<div class="product-details-hover">';
$out .= "<h3><a href='{$link}'>" . $product->get_title() . '</a></h3>';
$rating = $product->get_rating_html();
//get rating
$rating = !empty($rating) ? $rating : "";
$out .= $rating;
$out .= $price;
$out .= $add_to_cart;
if (shortcode_exists('yith_wcwl_add_to_wishlist')) {
$out .= do_shortcode('[yith_wcwl_add_to_wishlist]');
}
$out .= '</div><!-- Product Details Hover -->';
$out .= "</div> </div> <!-- Product Wrapper End-->";
echo $out;
}
开发者ID:PNW3DEV,项目名称:iesdb-v1,代码行数:34,代码来源:index.php
示例9: the_title
" title="<?php
the_title();
?>
"><h3><?php
the_title();
?>
</h3></a>
</div>
</div>
<div class="product-price-cart">
<div class="recentPrice"><span class="price"><?php
echo $product->get_price_html();
?>
</span></div>
<div class="recentCart"><?php
woocommerce_template_loop_add_to_cart($product);
?>
</div>
</div>
</div>
<?php
$count++;
if ($countitem == 4) {
$countitem = 0;
?>
</li>
<?php
}
$countitem++;
$countPost++;
开发者ID:shimion,项目名称:sim-buller,代码行数:31,代码来源:up-sells.php
示例10: woo_loop_product_thumbnail
/**
*
* Product thumbnail for loop
*/
function woo_loop_product_thumbnail()
{
if (has_post_thumbnail()) {
echo '<figure class="featured-image img-preload img-hover">';
echo '<a href="' . get_permalink() . '">';
the_post_thumbnail('shop_catalog');
echo '<div class="overlay"></div>';
echo '</a>';
woocommerce_template_loop_add_to_cart();
woocommerce_show_product_loop_sale_flash();
echo '</figure>';
}
}
开发者ID:sniezekjp,项目名称:prod-fs,代码行数:17,代码来源:woo.php
示例11: tpvc_wc_product_featured_shortcode
//.........这里部分代码省略.........
?>
>
<div class="featured-top">
<?php
the_post_thumbnail('custom-woo-thumbnail');
?>
</div>
<?php
if ("yes" != $tpvc_wc_featured_hide_prodprice || "yes" != $tpvc_wc_featured_hide_prodtitle || "yes" != $tpvc_wc_featured_hide_prodlink || "yes" != $tpvc_wc_featured_hide_prodcart) {
?>
<div class="featured-bottom">
<?php
if ("yes" != $tpvc_wc_featured_hide_prodprice) {
?>
<div class="featured-price">
<?php
woocommerce_template_loop_price();
?>
</div>
<?php
}
?>
<?php
if ("yes" != $tpvc_wc_featured_hide_prodlink || "yes" != $tpvc_wc_featured_hide_prodcart) {
?>
<div class="featured-action">
<?php
if ("yes" != $tpvc_wc_featured_hide_prodlink) {
?>
<a href="<?php
echo get_permalink();
?>
" class="button detail_button_loop">
<?php
if (!$tpvc_wc_featured_hide_prodlink_text) {
$tpvc_wc_featured_hide_prodlink_text = __('detail', 'tokopress');
}
echo $tpvc_wc_featured_hide_prodlink_text;
?>
</a>
<?php
}
?>
<?php
if ("yes" != $tpvc_wc_featured_hide_prodcart) {
?>
<?php
woocommerce_template_loop_add_to_cart();
?>
<?php
}
?>
</div>
<?php
}
?>
<?php
if ("yes" != $tpvc_wc_featured_hide_prodtitle) {
?>
<div class="featured-title">
<h3><a href="<?php
echo get_permalink();
?>
"><?php
the_title();
?>
</a></h3>
</div>
<?php
}
?>
</div>
<?php
}
?>
</li>
<?php
}
?>
</ul>
</div>
<?php
}
wp_reset_postdata();
$js_code = '$(\'.tpvc-featured-product ul.owl-carousel\').owlCarousel({
items : 1,
loop: true,
nav : true,
stopOnHover : true,
navText : [\'<i class="fa fa-chevron-left"></i>\', \'<i class="fa fa-chevron-right"></i>\'],
lazyLoad: true,
autoplay: true,
dots: false
});';
wc_enqueue_js($js_code);
return ob_get_clean();
}
开发者ID:Artgorae,项目名称:wp-artgorae,代码行数:101,代码来源:wc_featured.php
示例12: product_add_to_cart
/**
* Display a single product price + cart button
*
* @access public
* @param array $atts
* @return string
*/
public function product_add_to_cart($atts)
{
global $wpdb, $post, $woocommerce;
if (empty($atts)) {
return;
}
if (!isset($atts['style'])) {
$atts['style'] = 'border:4px solid #ccc; padding: 12px;';
}
if (isset($atts['id'])) {
$product_data = get_post($atts['id']);
} elseif (isset($atts['sku'])) {
$product_id = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='_sku' AND meta_value='%s' LIMIT 1", $atts['sku']));
$product_data = get_post($product_id);
} else {
return;
}
if ('product' == $product_data->post_type) {
$product = $woocommerce->setup_product_data($product_data);
ob_start();
?>
<p class="product woocommerce" style="<?php
echo $atts['style'];
?>
">
<?php
echo $product->get_price_html();
?>
<?php
woocommerce_template_loop_add_to_cart();
?>
</p><?php
// Restore Product global in case this is shown inside a product post
$woocommerce->setup_product_data($post);
return ob_get_clean();
} elseif ('product_variation' == $product_data->post_type) {
$product = get_product($product_data->post_parent);
$GLOBALS['product'] = $product;
$variation = get_product($product_data);
ob_start();
?>
<p class="product product-variation" style="<?php
echo $atts['style'];
?>
">
<?php
echo $product->get_price_html();
?>
<?php
$link = $product->add_to_cart_url();
$label = apply_filters('add_to_cart_text', __('Add to cart', 'woocommerce'));
$link = add_query_arg('variation_id', $variation->variation_id, $link);
foreach ($variation->variation_data as $key => $data) {
if ($data) {
$link = add_query_arg($key, $data, $link);
}
}
printf('<a href="%s" rel="nofollow" data-product_id="%s" class="button add_to_cart_button product_type_%s">%s</a>', esc_url($link), $product->id, $product->product_type, $label);
?>
</p><?php
wp_reset_postdata();
return ob_get_clean();
}
}
开发者ID:shahadat014,项目名称:geleyi,代码行数:77,代码来源:class-wc-shortcodes.php
示例13: pmc_productBlock
//.........这里部分代码省略.........
}
?>
</div>
</div>
<?php
} else {
?>
<div class="recentimage">
<div class="image">
<div class="loading"></div>
<?php
if (has_post_thumbnail(get_the_ID())) {
echo '<img src = ' . $image . ' alt = "' . get_the_title() . '" > ';
} else {
echo '<img src="' . woocommerce_placeholder_img_src() . '" alt="Placeholder" width="230px" height="' . $pmc_data['catalog_img_height'] . 'px" />';
}
?>
</div>
</div>
<?php
if ($product_ajax != 'true') {
?>
</a>
<?php
}
?>
<?php
}
?>
<div class="recentdescription">
<?php
woocommerce_show_product_sale_flash($product);
?>
<?php
if ($product_ajax != 'true') {
?>
<a href="<?php
echo get_permalink(get_the_id());
?>
">
<?php
}
?>
<h3><?php
the_title();
?>
</h3>
<?php
if ($product_ajax != 'true') {
?>
</a>
<?php
}
?>
</div>
<?php
if ($product_ajax == 'true') {
?>
</div>
<?php
}
?>
<div class="product-price-cart">
<div class="recentPrice"><span class="price"><?php
echo $product->get_price_html();
?>
</span></div>
<div class="recentCart"><?php
woocommerce_template_loop_add_to_cart($product);
?>
</div>
</div>
</div>
<?php
$countPost++;
if ($countitem == $rows) {
$countitem = 0;
?>
</li>
<?php
}
$countitem++;
}
}
wp_reset_query();
?>
</ul>
</div>
</div>
</div>
</div>
<?php
}
开发者ID:shimion,项目名称:sim-buller,代码行数:101,代码来源:custom_functions.php
示例14: widget
//.........这里部分代码省略.........
while ($loop->have_posts()) {
$loop->the_post();
global $product;
global $woocommerce;
$large_image_url = wp_get_attachment_image_src(get_post_thumbnail_id($loop->post->ID), apply_filters('single_product_large_thumbnail_size', 'shop_catalog'));
$productlink = get_permalink($loop->post->ID);
$content_excerpt = apply_filters('woocommerce_short_description', $loop->post->post_excerpt);
?>
<li class="product-grid-container">
<div class="product-item">
<div class="title">
<h3 class="title-container product-titles"><a href="<?php
echo $productlink;
?>
"><?php
the_title();
?>
</a></h3>
</div>
<div class="image mosaic-block bar">
<?php
if ($content_excerpt != "") {
?>
<a href="<?php
echo $productlink;
?>
" class="mosaic-overlay">
<div class="details">
<?php
echo $content_excerpt;
?>
</div>
</a><?php
}
?>
<a href="<?php
echo $productlink;
?>
">
<span class="price heading-style"><?php
echo $product->get_price_html();
?>
</span>
<?php
woocommerce_show_product_sale_flash($loop->post, $product);
?>
<?php
if (!$large_image_url == "") {
?>
<img src="<?php
echo $large_image_url[0];
?>
" alt="" /><?php
} else {
?>
<img src="<?php
echo woocommerce_placeholder_img_src();
?>
" width="240" height="160" alt="" /><?php
}
?>
</a>
</div>
<div class="info">
<div class="float-left">
<?php
woocommerce_template_loop_rating($loop->post, $product);
?>
</div>
<div class="float-right">
<?php
woocommerce_template_loop_add_to_cart($loop->post, $product);
?>
</div>
</div>
</div>
</li>
<?php
}
wp_reset_query();
?>
</ul>
<div id="pager<?php
echo $uni_carousel_id;
$uni_carousel_id++;
?>
" class="pager"></div>
<div class="clear"></div>
</div><?php
}
?>
</div>
<?php
}
开发者ID:phanhoanglong2610,项目名称:flowershop,代码行数:101,代码来源:mywidgets.php
示例15: content
//.........这里部分代码省略.........
<?php
if ($enable_countdown == 'on' && $y > 1970) {
?>
<?php
if ($countdown_text) {
?>
<h3 class="title"><?php
echo esc_html($countdown_text);
?>
</h3>
<?php
}
?>
<span class="countdown-lastest" data-y="<?php
_e(esc_attr($y));
?>
" data-m="<?php
_e(esc_attr($m));
?>
" data-d="<?php
_e(esc_attr($d));
?>
" data-h="<?php
_e(esc_attr($h));
?>
" data-i="<?php
_e(esc_attr($mi));
?>
" data-s="<?php
_e(esc_attr($s));
?>
"></span>
<?php
}
?>
<?php
$meta_query = WC()->query->get_meta_query();
$ids = explode(',', $product_id);
$args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => 1, 'meta_query' => $meta_query, 'suppress_filter' => true);
if (is_array($ids) && !empty($ids)) {
$args['post__in'] = $ids;
$args['orderby'] = 'post__in';
}
$products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts));
if ($products->have_posts()) {
remove_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_rating');
while ($products->have_posts()) {
$products->the_post();
?>
<div class="product-info">
<h4 class="product-name"><a href="<?php
the_permalink();
?>
" title="<?php
the_title();
?>
"></a><?php
the_title();
?>
</h4>
<div class="desc"><?php
the_excerpt();
?>
</div>
<?php
/**
* woocommerce_after_shop_loop_item_title hook
*
* @hooked woocommerce_template_loop_price - 5
* @hooked woocommerce_template_loop_rating - 10
*/
do_action('kt_after_shop_loop_item_title');
?>
<div class="group-button-control">
<?php
woocommerce_template_loop_add_to_cart();
?>
<?php
kt_get_tool_wishlish();
?>
</div>
</div>
<?php
}
// end of the loop.
wp_reset_query();
wp_reset_postdata();
add_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_rating');
}
?>
</div>
</div>
</div>
</div>
</div>
<?php
}
return ob_get_clean();
}
开发者ID:acamboy,项目名称:kutetheme-wp,代码行数:101,代码来源:banner-title.php
示例16: 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>";
}
开发者ID:alfredpp,项目名称:sarath-portfolio,代码行数:12,代码来源:theme-woocommerce.php
示例17: replace_add_to_cart
function replace_add_to_cart()
{
global $product;
if ($product->get_stock_quantity() == 0 && $product->get_type() != 'variable') {
$link = $product->get_permalink();
echo '<a data-prod-id="' . $product->get_id() . '" data-link="' . $link . '" data-nome="' . $product->get_title() . '"class="encomendarAdd button" href="#" class="button addtocartbutton">Esgotago</a>';
} elseif ($product->get_type() == 'variable') {
$filhas = $product->get_children();
$estoque = 0;
foreach ($filhas as $filha => $id) {
$produto = get_product($id);
if ($produto->get_stock_quantity() != 0) {
$estoque = 1;
}
// echo '<prev>';
// print_r($produto->get_stock_quantity());
// echo '</prev>';
}
if ($estoque == 0) {
$link = $product->get_permalink();
echo '<a data-prod-id="' . $product->get_id() . '" data-link="' . $link . '" data-nome="' . $product->get_title() . '"class="encomendarAdd button" href="#" class="button addtocartbutton">Esgotago</a>';
} else {
woocommerce_template_loop_add_to_cart();
}
} else {
woocommerce_template_loop_add_to_cart();
}
}
开发者ID:willowmagrini,项目名称:dg,代码行数:28,代码来源:functions.php
示例18: wd_best_selling_product_slider_function
//.........这里部分代码省略.........
echo $_random_id;
?>
">
<?php
if (strlen(trim($title)) > 0 || strlen(trim($desc)) > 0) {
?>
<header class="shortcode-title-wrapper">
<?php
if (strlen(trim($title)) > 0) {
echo "<h3 class='heading-title slider-title'>" . esc_html($title) . "</h3>";
}
?>
</header>
<?php
if (strlen(trim($desc)) > 0) {
echo "<p class='slider-desc-wrapper'>" . esc_html($desc) . "</p>";
}
?>
<?php
}
?>
<?php
if (isset($_big_prod) && $_big_prod->is_visible()) {
$_product = wc_get_product($_big_prod->id);
$post = $_product->post;
$extra_class = 'col-sm-12';
$product = wc_setup_product_data($post);
$image_title = esc_attr($_product->get_title());
$product_link = esc_url($_product->get_permalink());
$image = get_the_post_thumbnail($post->ID, apply_filters('single_product_large_thumbnail_size', 'shop_single'), array('alt' => $image_title, 'title' => $image_title));
echo '<div class="wd-big-product product ' . $extra_class . '">';
echo sprintf('<div class="wd_image product-thumbnail-wrapper"><a title="%s" href="%s">%s</a></div>', $image_title, $product_link, $image);
echo '<div class="wd_meta product-meta-wrapper"><p class="price">' . $_product->get_price_html() . '</p>';
woocommerce_template_loop_add_to_cart();
//echo $temp_add_to_cart_data;
echo '</div></div>';
wc_setup_product_data($post);
}
?>
<div class="<?php
echo $show_type;
?>
product-slider-wrapper ">
<div class="product-slider-inner loading">
<?php
$current_row = 0;
?>
<?php
woocommerce_product_loop_start();
?>
<?php
$woocommerce_loop['columns'] = 1;
?>
<?php
while ($products->have_posts()) {
$products->the_post();
?>
<?php
if ($row > 1 && $current_row % $row == 0) {
echo '<div class="products_group">';
开发者ID:mynein,项目名称:myne,代码行数:67,代码来源:best_selling_product_slider.php
示例19: avia_add_cart_button
function avia_add_cart_button()
{
global $product, $avia_config;
if ($product->product_type == 'bundle') {
$product = new WC_Product_Bundle($product->id);
}
$extraClass = "";
ob_start();
woocommerce_template_loop_add_to_cart();
$output = ob_get_clean();
if (!empty($output)) {
$pos = strpos($output, ">");
if ($pos !== false) {
$output = substr_replace($output, "><span class='avia-font-entypo-fontello'>" . $avia_config['font_icons']['cart'] . "</span> ", $pos, strlen(1));
}
}
if ($product->product_type == 'variable' && empty($output)) {
$output = "<a class='add_to_cart_button button product_type_variable' href='" . get_permalink($product->id) . "'><span class='avia-font-entypo-fontello'>" . $avia_config['font_icons']['details'] . "</span> " . __('Select options', 'avia_framework') . "</a>";
}
if ($product->product_type == 'simple') {
$output .= "<a class='button show_details_button' href='" . get_permalink($product->id) . "'><span class='avia-font-entypo-fontello'>" . $avia_config['font_icons']['details'] . "</span> " . __('Show Details', 'avia_framework') . "</a>";
} else {
$extraClass = "single_button";
}
if (empty($extraClass)) {
$output .= " <span class='button-mini-delimiter'></span>";
}
if ($output && !post_password_required()) {
echo "<div class='avia_cart_buttons {$extraClass}'>{$output}</div>";
}
}
开发者ID:bluedrone,项目名称:plugins,代码行数:31,代码来源:config.php
示例20: wd_hot_product
function wd_hot_product($atts, $content = null)
{
extract(shortcode_atts(array('title' => '', 'number' => '4'), $atts));
$post_type = "product";
$thumbnail_width = 60;
$thumbnail_height = 60;
wp_reset_query();
$popular = new wp_query(array('post_type' => 'product', 'posts_per_page' => $number, '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();
$count = 1;
ob_start();
?>
<div class="wd_hot_product wd_hot_loading">
<div class="wd_heading">
<h5>hot products</h5>
<div class="wd_number_real"><span>1/<?php
echo $popular->post_count;
?>
</span></div>
</div>
<ul class="products popular-post-list<?php
echo $id_widget;
?>
">
<?php
while ($popular->have_posts()) {
$popular->the_post();
?>
<li class="post-<?php
echo $post->ID;
?>
product type-product status-publish henry">
<div class="wd_number"><span><?php
echo $count;
?>
/<?php
echo $popular->post_count;
?>
</span></div>
<div class="wd_product_wrapper">
<div class="product_thumbnail_wrapper 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>
<?php
global $wd_data;
if (!isset($wd_data['wd_catelog_mod']) || isset($wd_data['wd_catelog_mod']) && $wd_data['wd_catelog_mod'] == 1) {
?>
<div class='list_add_to_cart'>
<?php
woocommerce_template_loop_add_to_cart();
?>
</div>
<?php
}
?>
</div><!-- .image -->
<?php
$product = get_product($popular->post);
?>
<div class="product-meta-wrapper 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>
<input type='hidden' value='<?php
echo $product->id;
?>
' class='hidden_product_id product_hidden_<?php
echo $product->id;
?>
'>
</div>
//.........这里部分代码省略.........
开发者ID:proj-2014,项目名称:vlan247-test-wp2,代码行数:101,代码来源:hot_product.php
注:本文中的woocommerce_template_loop_add_to_cart函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论