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);
    }
}
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>';
}
 /**
  * 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);
 }
 /**
  * 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'));
 }
Beispiel #5
0
 /**
  * @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);
 }
 /**
  * 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);
 }
 /**
  * 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);
 }
 /**
  * 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'));
 }
 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;
 }
 /**
  * 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);
     }
 }
Beispiel #11
0
 /**
  * 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);
 }
Beispiel #12
0
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);
    }
}
 /**
  * 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;
 }
 /**
  *  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);
 }