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

PHP woocommerce_get_template函数代码示例

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

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



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

示例1: simulator

 /**
  * Display the simulator.
  *
  * @return string Simulator HTML.
  */
 public static function simulator()
 {
     global $product;
     if (!is_product() || !self::$activated) {
         return;
     }
     if ($product->needs_shipping() && $product->is_in_stock() && in_array($product->product_type, array('simple', 'variable'))) {
         $options = get_option('woocommerce_correios_settings');
         if ('variable' == $product->product_type) {
             $style = 'display: none';
             $ids = array();
             foreach ($product->get_available_variations() as $variation) {
                 $_variation = get_product($variation['variation_id']);
                 $ids[] = $_variation->needs_shipping() ? $_variation->variation_id : '';
             }
             $ids = implode(',', array_filter($ids));
         } else {
             $style = '';
             $ids = $product->id;
         }
         if (isset($options['display_date']) && 'yes' == $options['display_date']) {
             $title = __('Shipping and delivery time', 'woocommerce-correios');
             $description = __('Calculate the shipping and delivery time estimated to your region.', 'woocommerce-correios');
         } else {
             $title = __('Shipping', 'woocommerce-correios');
             $description = __('Calculate shipping estimated to your region.', 'woocommerce-correios');
         }
         woocommerce_get_template('single-product/correios-simulator.php', array('product' => $product, 'style' => $style, 'ids' => $ids, 'title' => $title, 'description' => $description), '', WC_Correios::get_templates_path());
     }
 }
开发者ID:pensesmart,项目名称:woocommerce-correios,代码行数:35,代码来源:class-wc-correios-product-shipping-simulator.php


示例2: woocommerce_order_tracking

function woocommerce_order_tracking($atts)
{
    global $woocommerce;
    $woocommerce->nocache();
    extract(shortcode_atts(array(), $atts));
    global $post;
    if ($_POST) {
        $woocommerce->verify_nonce('order_tracking');
        if (isset($_POST['orderid']) && $_POST['orderid']) {
            $order_id = $_POST['orderid'];
        } else {
            $order_id = 0;
        }
        if (isset($_POST['order_email']) && $_POST['order_email']) {
            $order_email = trim($_POST['order_email']);
        } else {
            $order_email = '';
        }
        $order = new WC_Order(apply_filters('woocommerce_shortcode_order_tracking_order_id', $order_id));
        if ($order->id && $order_email) {
            if (strtolower($order->billing_email) == strtolower($order_email)) {
                woocommerce_get_template('order/tracking.php', array('order' => $order));
                return;
            }
        }
        echo '<p>' . sprintf(__('Sorry, we could not find that order id in our database. <a href="%s">Want to retry?</a>', 'woocommerce'), get_permalink($post->ID)) . '</p>';
    } else {
        woocommerce_get_template('order/form-tracking.php');
    }
}
开发者ID:rajveerbeniwal,项目名称:rooms-dhkh,代码行数:30,代码来源:shortcode-order_tracking.php


示例3: woocommerce_template_loop_add_to_cart

 function woocommerce_template_loop_add_to_cart()
 {
     if (!is_user_logged_in()) {
         return;
     }
     woocommerce_get_template('loop/add-to-cart.php');
 }
开发者ID:shahadat014,项目名称:geleyi,代码行数:7,代码来源:hide-price.php


示例4: woocommerce_auction_pay

 /**
  * Output the to pay block.
  *
  * @access public
  * @subpackage	Product
  * @return void
  * 
  */
 function woocommerce_auction_pay()
 {
     global $product;
     if ($product->product_type == 'auction') {
         woocommerce_get_template('single-product/pay.php');
     }
 }
开发者ID:Omuze,项目名称:barakat,代码行数:15,代码来源:woocommerce-simple-auctions-templating.php


示例5: my_bookings

 /**
  * Show a users bookings
  */
 public function my_bookings()
 {
     $bookings = WC_Bookings_Controller::get_bookings_for_user(get_current_user_id());
     if ($bookings) {
         woocommerce_get_template('myaccount/my-bookings.php', array('bookings' => $bookings), 'woocommerce-bookings/', WC_BOOKINGS_TEMPLATE_PATH);
     }
 }
开发者ID:nomadicmarc,项目名称:goodbay,代码行数:10,代码来源:class-wc-bookings-orders.php


示例6: woocommerce_product_categories

/**
 * List all (or limited) product categories
 **/
function woocommerce_product_categories($atts)
{
    global $woocommerce_loop;
    extract(shortcode_atts(array('number' => null, 'orderby' => 'name', 'order' => 'ASC', 'columns' => '4', 'hide_empty' => 1), $atts));
    if (isset($atts['ids'])) {
        $ids = explode(',', $atts['ids']);
        $ids = array_map('trim', $ids);
    } else {
        $ids = array();
    }
    $hide_empty = $hide_empty == true || $hide_empty == 1 ? 1 : 0;
    $args = array('number' => $number, 'orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'include' => $ids);
    $terms = get_terms('product_cat', $args);
    $woocommerce_loop['columns'] = $columns;
    ob_start();
    if ($product_categories) {
        echo '<ul class="products">';
        foreach ($product_categories as $category) {
            woocommerce_get_template('content-product_cat.php', array('category' => $category));
        }
        echo '</ul>';
    }
    wp_reset_query();
    return ob_get_clean();
}
开发者ID:eddiewilson,项目名称:new-ke,代码行数:28,代码来源:shortcode-init.php


示例7: output

 /**
  * Output the shortcode.
  *
  * @access public
  * @param array $atts
  * @return void
  */
 public static function output($atts)
 {
     global $woocommerce;
     // Check checkout is configured correctly
     if (current_user_can('manage_options')) {
         $pay_page_id = woocommerce_get_page_id('pay');
         $thanks_page_id = woocommerce_get_page_id('thanks');
         $pay_page = get_permalink($pay_page_id);
         $thanks_page = get_permalink($thanks_page_id);
         if (!$pay_page_id || !$thanks_page_id || empty($pay_page) || empty($thanks_page)) {
             $woocommerce->add_error(sprintf(__('WooCommerce Config Error: The checkout thanks/pay pages are missing - these pages are required for the checkout to function correctly. Please configure the pages <a href="%s">here</a>.', 'woocommerce'), admin_url('admin.php?page=woocommerce_settings&tab=pages')));
         }
     }
     // Show non-cart errors
     $woocommerce->show_messages();
     // Check cart has contents
     if (sizeof($woocommerce->cart->get_cart()) == 0) {
         return;
     }
     // Calc totals
     $woocommerce->cart->calculate_totals();
     // Check cart contents for errors
     do_action('woocommerce_check_cart_items');
     // Get checkout object
     $checkout = $woocommerce->checkout();
     if (empty($_POST) && $woocommerce->error_count() > 0) {
         woocommerce_get_template('checkout/cart-errors.php', array('checkout' => $checkout));
     } else {
         $non_js_checkout = !empty($_POST['woocommerce_checkout_update_totals']) ? true : false;
         if ($woocommerce->error_count() == 0 && $non_js_checkout) {
             $woocommerce->add_message(__('The order totals have been updated. Please confirm your order by pressing the Place Order button at the bottom of the page.', 'woocommerce'));
         }
         woocommerce_get_template('checkout/form-checkout.php', array('checkout' => $checkout));
     }
 }
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:42,代码来源:class-wc-shortcode-checkout.php


示例8: output

 /**
  * Output the shortcode.
  *
  * @access public
  * @param array $atts
  * @return void
  */
 public static function output($atts)
 {
     global $woocommerce;
     // Prevent cache
     $woocommerce->nocache();
     // Show non-cart errors
     $woocommerce->show_messages();
     // Check cart has contents
     if (sizeof($woocommerce->cart->get_cart()) == 0) {
         return;
     }
     // Calc totals
     $woocommerce->cart->calculate_totals();
     // Check cart contents for errors
     do_action('woocommerce_check_cart_items');
     // Get checkout object
     $checkout = $woocommerce->checkout();
     if (empty($_POST) && $woocommerce->error_count() > 0) {
         woocommerce_get_template('checkout/cart-errors.php', array('checkout' => $checkout));
     } else {
         $non_js_checkout = !empty($_POST['woocommerce_checkout_update_totals']) ? true : false;
         if ($woocommerce->error_count() == 0 && $non_js_checkout) {
             $woocommerce->add_message(__('The order totals have been updated. Please confirm your order by pressing the Place Order button at the bottom of the page.', 'woocommerce'));
         }
         woocommerce_get_template('checkout/form-checkout.php', array('checkout' => $checkout));
     }
 }
开发者ID:googlecode-mirror,项目名称:wpmu-demo,代码行数:34,代码来源:class-wc-shortcode-checkout.php


示例9: output

 /**
  * Output the shortcode.
  *
  * @access public
  * @param array $atts
  * @return void
  */
 public static function output($atts)
 {
     global $woocommerce;
     $woocommerce->nocache();
     extract(shortcode_atts(array(), $atts));
     global $post;
     if (!empty($_REQUEST['orderid'])) {
         $woocommerce->verify_nonce('order_tracking');
         $order_id = empty($_REQUEST['orderid']) ? 0 : esc_attr($_REQUEST['orderid']);
         $order_email = empty($_REQUEST['order_email']) ? '' : esc_attr($_REQUEST['order_email']);
         if (!$order_id) {
             echo '<p class="woocommerce-error">' . __('Please enter a valid order ID', 'woocommerce') . '</p>';
         } elseif (!$order_email) {
             echo '<p class="woocommerce-error">' . __('Please enter a valid order email', 'woocommerce') . '</p>';
         } else {
             $order = new WC_Order(apply_filters('woocommerce_shortcode_order_tracking_order_id', $order_id));
             if ($order->id && $order_email) {
                 if (strtolower($order->billing_email) == strtolower($order_email)) {
                     do_action('woocommerce_track_order', $order->id);
                     woocommerce_get_template('order/tracking.php', array('order' => $order));
                     return;
                 }
             } else {
                 echo '<p class="woocommerce-error">' . sprintf(__('Sorry, we could not find that order id in our database.', 'woocommerce'), get_permalink($post->ID)) . '</p>';
             }
         }
     }
     woocommerce_get_template('order/form-tracking.php');
 }
开发者ID:googlecode-mirror,项目名称:wpmu-demo,代码行数:36,代码来源:class-wc-shortcode-order-tracking.php


示例10: woocommerce_thankyou

/**
 * Outputs the order received page
 **/
function woocommerce_thankyou($atts)
{
    global $woocommerce;
    $woocommerce->nocache();
    $woocommerce->show_messages();
    $order = false;
    // Pay for order after checkout step
    if (isset($_GET['order'])) {
        $order_id = $_GET['order'];
    } else {
        $order_id = 0;
    }
    if (isset($_GET['key'])) {
        $order_key = $_GET['key'];
    } else {
        $order_key = '';
    }
    // Empty awaiting payment session
    unset($_SESSION['order_awaiting_payment']);
    if ($order_id > 0) {
        $order = new WC_Order($order_id);
        if ($order->order_key != $order_key) {
            unset($order);
        }
    }
    woocommerce_get_template('checkout/thankyou.php', array('order' => $order));
}
开发者ID:rajveerbeniwal,项目名称:rooms-dhkh,代码行数:30,代码来源:shortcode-thankyou.php


示例11: woocommerce_order_tracking

function woocommerce_order_tracking($atts)
{
    global $woocommerce, $order;
    extract(shortcode_atts(array(), $atts));
    global $post;
    if ($_POST) {
        $order =& new woocommerce_order();
        if (isset($_POST['orderid']) && $_POST['orderid'] > 0) {
            $order->id = (int) $_POST['orderid'];
        } else {
            $order->id = 0;
        }
        if (isset($_POST['order_email']) && $_POST['order_email']) {
            $order_email = trim($_POST['order_email']);
        } else {
            $order_email = '';
        }
        $woocommerce->verify_nonce('order_tracking');
        if ($order->id && $order_email && $order->get_order($order->id)) {
            if ($order->billing_email == $order_email) {
                woocommerce_get_template('order/tracking.php');
                return;
            }
        }
        echo '<p>' . sprintf(__('Sorry, we could not find that order id in our database. <a href="%s">Want to retry?</a>', 'woothemes'), get_permalink($post->ID)) . '</p>';
    } else {
        woocommerce_get_template('order/tracking-form.php');
    }
}
开发者ID:randyhoyt,项目名称:woocommerce,代码行数:29,代码来源:shortcode-order_tracking.php


示例12: add_to_cart

 /**
  * Add to cart for bookings
  */
 public function add_to_cart()
 {
     global $product;
     // Prepare form
     $booking_form = new WC_Booking_Form($product);
     // Get template
     woocommerce_get_template('single-product/add-to-cart/booking.php', array('booking_form' => $booking_form), 'woocommerce-bookings', WC_BOOKINGS_TEMPLATE_PATH);
 }
开发者ID:baperrou,项目名称:pedal-bookings,代码行数:11,代码来源:class-wc-booking-cart-manager.php


示例13: wc_get_template

 /**
  * @since 1.1.0 of SA_WC_Compatibility
  */
 public static function wc_get_template($template_path)
 {
     if (self::is_wc_21()) {
         return wc_get_template($template_path);
     } else {
         return woocommerce_get_template($template_path);
     }
 }
开发者ID:WP-Panda,项目名称:allergenics,代码行数:11,代码来源:class-wc-compatibility.php


示例14: show_product_thumbnails

 /**
  * Change product-thumbnails.php template
  * 
  * @access public
  * @return void
  * @since 1.0.0
  */
 public function show_product_thumbnails()
 {
     if (function_exists('wc_get_template')) {
         wc_get_template('single-product/product-thumbnails-magnifier.php', array(), '', YITH_WCMG_DIR . 'templates/');
     } else {
         woocommerce_get_template('single-product/product-thumbnails-magnifier.php', array(), '', YITH_WCMG_DIR . 'templates/');
     }
 }
开发者ID:zgomotos,项目名称:Bazar,代码行数:15,代码来源:class.yith-wcmg-frontend.php


示例15: output

 /**
  * Output the shortcode.
  *
  * @access public
  * @param array $atts
  * @return void
  */
 public static function output($atts)
 {
     global $woocommerce;
     if (!is_user_logged_in()) {
         return;
     }
     woocommerce_get_template('myaccount/form-change-password.php');
 }
开发者ID:joshquila,项目名称:demo2-youse,代码行数:15,代码来源:class-wc-shortcode-change-password.php


示例16: my_packages

 /**
  * Show my packages
  */
 public function my_packages()
 {
     if (($packages = wc_paid_listings_get_user_packages(get_current_user_id(), 'job_listing')) && is_array($packages) && sizeof($packages) > 0) {
         woocommerce_get_template('my-packages.php', array('packages' => $packages, 'type' => 'job_listing'), 'wc-paid-listings/', JOB_MANAGER_WCPL_TEMPLATE_PATH);
     }
     if (($packages = wc_paid_listings_get_user_packages(get_current_user_id(), 'resume')) && is_array($packages) && sizeof($packages) > 0) {
         woocommerce_get_template('my-packages.php', array('packages' => $packages, 'type' => 'resume'), 'wc-paid-listings/', JOB_MANAGER_WCPL_TEMPLATE_PATH);
     }
 }
开发者ID:sabdev1,项目名称:sabstaff,代码行数:12,代码来源:class-wc-paid-listings-orders.php


示例17: render

 /**
  * Render the shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render($args, $content = '')
 {
     global $woocommerce, $smof_data;
     $defaults = T4PCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'cat_slug' => '', 'number_posts' => 10, 'show_cats' => 'yes', 'show_price' => 'yes', 'show_buttons' => 'yes', 'picture_size' => 'fixed'), $args);
     extract($defaults);
     self::$args = $defaults;
     $html = '';
     $buttons = '';
     if (class_exists('Woocommerce')) {
         $number_posts = (int) $number_posts;
         $args = array('post_type' => 'product', 'posts_per_page' => $number_posts, 'meta_query' => array(array('key' => '_thumbnail_id', 'compare' => '!=', 'value' => null)));
         if ($cat_slug) {
             $cat_id = explode(',', $cat_slug);
             $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => $cat_id));
         }
         $css_class = 'simple-products-slider';
         if ($picture_size != 'fixed') {
             $css_class = 'simple-products-slider-variable';
         }
         $products = new WP_Query($args);
         $products_wrapper = $product = '';
         if ($products->have_posts()) {
             while ($products->have_posts()) {
                 $products->the_post();
                 $image = $price_tag = $terms = '';
                 if (has_post_thumbnail()) {
                     if ($smof_data['image_rollover']) {
                         $image = get_the_post_thumbnail(get_the_ID(), 'shop_catalog');
                     } else {
                         $image = sprintf('<a href="%s">%s</a>', get_permalink(get_the_ID()), get_the_post_thumbnail(get_the_ID(), 'shop_catalog'));
                     }
                     if ($show_cats == 'yes') {
                         $terms = get_the_term_list(get_the_ID(), 'product_cat', sprintf('<span %s>', T4PCore_Plugin::attributes('cats')), ', ', '</span>');
                     }
                     ob_start();
                     woocommerce_get_template('loop/price.php');
                     $price = ob_get_contents();
                     ob_end_clean();
                     if ($price && $show_price == 'yes') {
                         $price_tag = $price;
                     }
                     if ($show_buttons == 'yes') {
                         ob_start();
                         woocommerce_get_template('loop/add-to-cart.php');
                         $cart_button = ob_get_contents();
                         ob_end_clean();
                         $buttons = sprintf('<div %s>%s</div>', T4PCore_Plugin::attributes('product-buttons'), $cart_button, get_permalink());
                     }
                     $product .= sprintf('<li><div %s aria-haspopup="true">%s<div %s><div %s><h3><a href="%s">%s</a></h3><br />%s%s%s</div></div></div></li>', T4PCore_Plugin::attributes('woo-product-slider-shortcode-img-div'), $image, T4PCore_Plugin::attributes('image-extras'), T4PCore_Plugin::attributes('image-extras-content'), get_permalink(), get_the_title(), $terms, $price_tag, $buttons);
                 }
             }
             $products_wrapper = sprintf('<ul>%s</ul>', $product);
         }
         $html = sprintf('<div %s><div %s><div %s><div %s>%s</div><div %s><span %s></span><span %s></span></div></div></div><div class="t4p-clearfix"></div></div>', T4PCore_Plugin::attributes('woo-product-slider-shortcode'), T4PCore_Plugin::attributes($css_class . ' simple-products-slider'), T4PCore_Plugin::attributes('es-carousel-wrapper t4p-carousel-large'), T4PCore_Plugin::attributes('es-carousel'), $products_wrapper, T4PCore_Plugin::attributes('es-nav'), T4PCore_Plugin::attributes('es-nav-prev'), T4PCore_Plugin::attributes('es-nav-next'));
     }
     return $html;
 }
开发者ID:berniecultess,项目名称:infirev,代码行数:63,代码来源:class-woo-product-slider.php


示例18: variable_add_to_cart

 /**
  * Output the variable product add to cart area.
  *
  * @access public
  * @since 1.0.0
  */
 function variable_add_to_cart()
 {
     global $product;
     // Enqueue variation scripts
     wp_enqueue_script('wc-add-to-cart-variation');
     $attributes = $product->get_variation_attributes();
     // Load the template
     woocommerce_get_template('single-product/add-to-cart/variable-wccl.php', array('available_variations' => $product->get_available_variations(), 'attributes' => $attributes, 'selected_attributes' => $product->get_variation_default_attributes(), 'attributes_types' => $this->get_variation_attributes_types($attributes)), '', YITH_WCCL_DIR . 'templates/');
 }
开发者ID:shahadat014,项目名称:geleyi,代码行数:15,代码来源:class.yith-wccl-frontend.php


示例19: woocommerce_template_loop_add_to_cart

 function woocommerce_template_loop_add_to_cart()
 {
     global $product;
     if ($product->product_type == "variable") {
         woocommerce_variable_add_to_cart();
     } else {
         woocommerce_get_template('loop/add-to-cart.php');
     }
 }
开发者ID:samiksha369,项目名称:majorcraft,代码行数:9,代码来源:woocommerce-ajax-add-to-cart-variable-products.php


示例20: output

    /**
     * Output the shortcode.
     *
     * @access public
     * @param array $atts
     * @return void
     */
    public static function output($atts)
    {
        global $woocommerce;
        $woocommerce->nocache();
        if (!is_user_logged_in()) {
            return;
        }
        extract(shortcode_atts(array('order_count' => 10), $atts));
        $user_id = get_current_user_id();
        $order_id = isset($_GET['order']) ? $_GET['order'] : 0;
        $order = new WC_Order($order_id);
        if ($order_id == 0) {
            woocommerce_get_template('myaccount/my-orders.php', array('order_count' => 'all' == $order_count ? -1 : $order_count));
            return;
        }
        if ($order->user_id != $user_id) {
            echo '<div class="woocommerce-error">' . __('Invalid order.', 'woocommerce') . ' <a href="' . get_permalink(woocommerce_get_page_id('myaccount')) . '">' . __('My Account &rarr;', 'woocommerce') . '</a>' . '</div>';
            return;
        }
        $status = get_term_by('slug', $order->status, 'shop_order_status');
        echo '<p class="order-info">' . sprintf(__('Order <mark class="order-number">%s</mark> made on <mark class="order-date">%s</mark>', 'woocommerce'), $order->get_order_number(), date_i18n(get_option('date_format'), strtotime($order->order_date))) . '. ' . sprintf(__('Order status: <mark class="order-status">%s</mark>', 'woocommerce'), __($status->name, 'woocommerce')) . '.</p>';
        $notes = $order->get_customer_order_notes();
        if ($notes) {
            ?>
			<h2><?php 
            _e('Order Updates', 'woocommerce');
            ?>
</h2>
			<ol class="commentlist notes">
				<?php 
            foreach ($notes as $note) {
                ?>
				<li class="comment note">
					<div class="comment_container">
						<div class="comment-text">
							<p class="meta"><?php 
                echo date_i18n(__('l jS \\of F Y, h:ia', 'woocommerce'), strtotime($note->comment_date));
                ?>
</p>
							<div class="description">
								<?php 
                echo wpautop(wptexturize($note->comment_content));
                ?>
							</div>
			  				<div class="clear"></div>
			  			</div>
						<div class="clear"></div>
					</div>
				</li>
				<?php 
            }
            ?>
			</ol>
			<?php 
        }
        do_action('woocommerce_view_order', $order_id);
    }
开发者ID:googlecode-mirror,项目名称:wpmu-demo,代码行数:64,代码来源:class-wc-shortcode-view-order.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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