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

PHP WC_Shortcodes类代码示例

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

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



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

示例1: wc_products_price_range

function wc_products_price_range($atts, $content, $shortcode)
{
    if (class_exists('WooCommerce')) {
        $shortcodes = new WC_Shortcodes();
        if (is_array($atts)) {
            $min = (int) $atts['min'];
            $max = (int) $atts['max'];
            if ($min && $max) {
                $and = "meta_value BETWEEN {$min} AND {$max}";
            } else {
                if ($min) {
                    $and = "meta_value >= {$min}";
                } elseif ($max) {
                    $and = "meta_value <= {$max}";
                }
            }
            if ($and) {
                global $wpdb;
                $query = "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = '_price' AND {$and}";
                $ids = $wpdb->get_col($query);
                if (!empty($ids)) {
                    $atts['ids'] = implode(",", $ids);
                }
            }
        }
        return $shortcodes->products($atts);
    }
}
开发者ID:GoWP,项目名称:wc-products-price-range,代码行数:28,代码来源:wc-products-price-range.php


示例2: nm_shortcode_product_categories

function nm_shortcode_product_categories($atts, $content = NULL)
{
    global $woocommerce_loop;
    // Columns (large column is set via shortcode attribute)
    $woocommerce_loop['columns_small'] = '1';
    $woocommerce_loop['columns_medium'] = '2';
    if (isset($atts['packery']) && $atts['packery'] === '1') {
        nm_add_page_include('product_categories');
        // Enqueue script
        wp_enqueue_script('packery', NM_THEME_URI . '/js/plugins/packery.pkgd.min.js', array(), '1.3.2', true);
        $packery_class = 'packery-enabled nm-loader';
    } else {
        $packery_class = '';
    }
    return '<div class="nm-product-categories ' . $packery_class . '">' . WC_Shortcodes::product_categories($atts) . '</div>';
}
开发者ID:tccyp001,项目名称:onemore-wordpress,代码行数:16,代码来源:product-categories.php


示例3: get

 /**
  * Get the shortcode content.
  *
  * @access public
  * @param array $atts
  * @return string
  */
 public static function get($atts)
 {
     return WC_Shortcodes::shortcode_wrapper(array(__CLASS__, 'output'), $atts);
 }
开发者ID:ayoayco,项目名称:upbeat,代码行数:11,代码来源:class-wc-shortcode-checkout.php


示例4: pricing_table_shortcode

 /**
  * Pricing table shortcode: renders a table of product prices
  *
  * @since 3.0
  * @param array $atts associative array of shortcode parameters
  * @return string shortcode content
  */
 public function pricing_table_shortcode($atts)
 {
     require_once 'classes/shortcodes/class-wc-price-calculator-shortcode-pricing-table.php';
     return WC_Shortcodes::shortcode_wrapper(array('WC_Price_Calculator_Shortcode_Pricing_Table', 'output'), $atts, array('class' => 'wc-measurement-price-calculator'));
 }
开发者ID:abcode619,项目名称:wpstuff,代码行数:12,代码来源:woocommerce-measurement-price-calculator.php


示例5: shortcode_wrapper

 /**
  * @deprecated 2.1.0
  * @param       $function
  * @param array $atts
  * @param array $wrapper
  * @return string
  */
 public function shortcode_wrapper($function, $atts = array(), $wrapper = array('class' => 'woocommerce', 'before' => null, 'after' => null))
 {
     _deprecated_function('Woocommerce->shortcode_wrapper', '2.1', 'WC_Shortcodes::shortcode_wrapper');
     return WC_Shortcodes::shortcode_wrapper($function, $atts, $wrapper);
 }
开发者ID:donwea,项目名称:nhap.org,代码行数:12,代码来源:woocommerce.php


示例6: get

 /**
  * Get shortcode content
  *
  * @access public
  * @param array $atts
  * @return string
  * 
  */
 public static function get($atts)
 {
     global $woocommerce;
     return WC_Shortcodes::shortcode_wrapper(array(__CLASS__, 'output'), $atts);
 }
开发者ID:Omuze,项目名称:barakat,代码行数:13,代码来源:woocommerce-simple-auctions-shortcode-my-auctions.php


示例7: get_woocommerce_review_order_angelleye

 /**
  * Add the gateway to woocommerce
  */
 function get_woocommerce_review_order_angelleye($atts)
 {
     global $woocommerce;
     return WC_Shortcodes::shortcode_wrapper(array($this, 'woocommerce_review_order_angelleye'), $atts);
 }
开发者ID:Nat97,项目名称:paypal-woocommerce,代码行数:8,代码来源:paypal-for-woocommerce.php


示例8: get

 /**
  * Get the shortcode content
  *
  * @since 3.0
  * @param array $atts associative array of shortcode parameters
  * @return string shortcode content
  */
 public static function get($atts)
 {
     return WC_Shortcodes::shortcode_wrapper(array(__CLASS__, 'output'), $atts, array('class' => 'wc-measurement-price-calculator'));
 }
开发者ID:baden03,项目名称:access48,代码行数:11,代码来源:class-wc-price-calculator-shortcode-pricing-table.php


示例9: woo_add_to_cart_shortcode

 function woo_add_to_cart_shortcode($atts)
 {
     if (empty($atts)) {
         return '';
     }
     extract(shortcode_atts(array('title' => '', 'url' => '', 'target' => '', 'tooltip' => '', 'id' => '', 'sku' => '', 'style' => 'border:4px solid #ccc; padding: 12px;', 'show_price' => 'true'), $atts));
     if (!empty($url) && !empty($title)) {
         $title = '<a href="' . esc_url($url) . '"' . (!empty($target) ? ' target="' . esc_attr($target) . '"' : '') . '>' . esc_html($title) . '</a>';
     }
     $output = $title ? '<div class="ts-add-to-cart' . ($tooltip ? ' ts-cart-tooltip ts-cart-tooltip-' . esc_attr($tooltip) : '') . '"><div class="add-to-cart-title"><h4>' . $title . '</h4></div>' : '';
     if (class_exists('WC_Shortcodes')) {
         $output .= WC_Shortcodes::product_add_to_cart($atts);
     }
     $output .= $title ? '</div>' : '';
     return $output;
 }
开发者ID:ThemeSama,项目名称:themesama-shortcodes,代码行数:16,代码来源:slupy-shortcodes.php


示例10: shortcode_wrapper

 /**
  * WooCommerce Shortcode wrapper
  *
  * @since 2.0
  * @param mixed $function shortcode callback
  * @param array $atts (default: array())
  * @param array $wrapper array of wrapper options (class, before, after)
  * @return string
  */
 public static function shortcode_wrapper($function, $atts = array(), $wrapper = array('class' => 'woocommerce', 'before' => null, 'after' => null))
 {
     if (self::is_wc_version_gte_2_1()) {
         return WC_Shortcodes::shortcode_wrapper($function, $atts, $wrapper);
     } else {
         global $woocommerce;
         return $woocommerce->shortcode_wrapper($function, $atts, $wrapper);
     }
 }
开发者ID:nomadicmarc,项目名称:goodbay,代码行数:18,代码来源:class-sv-wc-plugin-compatibility.php


示例11: intercept_woocommerce_my_account_shortcode

 /**
  * Intercept and replace woocommerce_my_account shortcode
  * 
  * @access public
  * @param array $atts
  * @return void
  */
 public function intercept_woocommerce_my_account_shortcode($atts)
 {
     return WC_Shortcodes::shortcode_wrapper(array('Subscriptio_My_Account', 'output'), $atts);
 }
开发者ID:qhuit,项目名称:dcosta,代码行数:11,代码来源:subscriptio.php


示例12: get_swr_view_rewards

function get_swr_view_rewards($atts)
{
    global $woocommerce;
    if (version_compare($woocommerce->version, '2.1.0') >= 0) {
        return WC_Shortcodes::shortcode_wrapper('get_swr_wrapper_view_rewards', $atts);
    } else {
        return $woocommerce->shortcode_wrapper('get_swr_wrapper_view_rewards', $atts);
    }
}
开发者ID:englsergio,项目名称:allsensations,代码行数:9,代码来源:swr-base.php


示例13: shortcode_product

 /**
  * New code of the [product] shortcode.
  *
  * @param  assoc $atts
  * @return string
  */
 public function shortcode_product($atts)
 {
     $result = WC_Shortcodes::product($atts);
     if ($result) {
         $new_result = preg_replace('/^<div class="woocommerce">\\s*<div class="row">/', '<div class="woocommerce"><div class="row"><div class="col-md-12">', trim($result));
         if ($new_result != $result) {
             return $new_result . '</div>';
         }
     }
     return $result;
 }
开发者ID:j-kenneth,项目名称:Expeero,代码行数:17,代码来源:AtWoocommerceShortcodesHelper.php


示例14: shortcode_my_auctions

 /**
  *  Shortcode for my auctions
  *
  * @access public
  * @param  array
  * @return 
  * 
  */
 function shortcode_my_auctions($atts)
 {
     global $woocommerce;
     return WC_Shortcodes::shortcode_wrapper(array('WC_Shortcode_Simple_Auction_My_Auctions', 'output'), $atts);
 }
开发者ID:Omuze,项目名称:barakat,代码行数:13,代码来源:woocommerce-simple-auctions.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP WC_Subscriptions类代码示例发布时间:2022-05-23
下一篇:
PHP WC_Shipping类代码示例发布时间: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