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

PHP wc_get_template函数代码示例

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

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



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

示例1: my_account_memberships

 /**
  * Output memberships table in My Account
  *
  * @since 1.0.0
  */
 public function my_account_memberships()
 {
     $customer_memberships = wc_memberships_get_user_memberships();
     if (!empty($customer_memberships)) {
         wc_get_template('myaccount/my-memberships.php', array('customer_memberships' => $customer_memberships));
     }
 }
开发者ID:eugene-gromky-co,项目名称:mindfulnesssummit,代码行数:12,代码来源:class-wc-memberships-frontend.php


示例2: registrations_add_to_cart

 public static function registrations_add_to_cart()
 {
     global $product;
     // Enqueue variation scripts
     wp_enqueue_script('wc-add-to-cart-variation');
     wc_get_template('single-product/add-to-cart/registration.php', array('available_variations' => $product->get_available_variations(), 'attributes' => $product->get_variation_attributes(), 'selected_attributes' => $product->get_variation_default_attributes()), '', plugin_dir_path(__FILE__) . 'templates/');
 }
开发者ID:HasteDesign,项目名称:Registrations-for-WooCommerce,代码行数:7,代码来源:registrations-for-woocommerce.php


示例3: output

 /**
  * Display saved cards
  */
 public function output()
 {
     if (!is_user_logged_in() || !($customer_id = get_user_meta(get_current_user_id(), '_stripe_customer_id', true)) || !is_string($customer_id)) {
         return;
     }
     $stripe = new WC_Gateway_Stripe();
     $cards = $stripe->get_saved_cards($customer_id);
     if ($cards) {
         wc_get_template('saved-cards.php', array('cards' => $cards), 'woocommerce-gateway-stripe/', WC_STRIPE_TEMPLATE_PATH);
     }
 }
开发者ID:avijitdeb,项目名称:flatterbox.com,代码行数:14,代码来源:class-wc-gateway-stripe-saved-cards.php


示例4: 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');
         }
         wc_get_template('single-product/correios-simulator.php', array('product' => $product, 'style' => $style, 'ids' => $ids, 'title' => $title, 'description' => $description), '', WC_Correios::get_templates_path());
     }
 }
开发者ID:rodrigo-mamangava,项目名称:nofluxo,代码行数:35,代码来源:class-wc-correios-product-shipping-simulator.php


示例5: widget

 /**
  * widget function.
  *
  * @see WP_Widget
  * @access public
  * @param array $args
  * @param array $instance
  * @return void
  */
 public function widget($args, $instance)
 {
     if ($this->get_cached_widget($args)) {
         return;
     }
     ob_start();
     extract($args);
     $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
     $number = absint($instance['number']);
     add_filter('posts_clauses', array(WC()->query, 'order_by_rating_post_clauses'));
     $query_args = array('posts_per_page' => $number, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product');
     $query_args['meta_query'] = WC()->query->get_meta_query();
     $r = new WP_Query($query_args);
     if ($r->have_posts()) {
         echo $before_widget;
         if ($title) {
             echo $before_title . $title . $after_title;
         }
         echo '<ul class="product_list_widget">';
         while ($r->have_posts()) {
             $r->the_post();
             wc_get_template('content-widget-product.php', array('show_rating' => true));
         }
         echo '</ul>';
         echo $after_widget;
     }
     remove_filter('posts_clauses', array(WC()->query, 'order_by_rating_post_clauses'));
     wp_reset_postdata();
     $content = ob_get_clean();
     echo $content;
     $this->cache_widget($args, $content);
 }
开发者ID:devmoonshine,项目名称:development,代码行数:41,代码来源:widget-top-rated-products.php


示例6: widget

 /**
  * widget function.
  *
  * @see WP_Widget
  * @access public
  * @param array $args
  * @param array $instance
  * @return void
  */
 public function widget($args, $instance)
 {
     global $comments, $comment, $woocommerce;
     if ($this->get_cached_widget($args)) {
         return;
     }
     ob_start();
     extract($args);
     $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
     $number = absint($instance['number']);
     $query_args = array('posts_per_page' => $number, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'post__in' => $viewed_products, 'orderby' => 'rand');
     $query_args['meta_query'] = array();
     $query_args['meta_query'][] = WC()->query->stock_status_meta_query();
     $query_args['meta_query'] = array_filter($query_args['meta_query']);
     $r = new WP_Query($query_args);
     if ($r->have_posts()) {
         echo $before_widget;
         if ($title) {
             echo $before_title . $title . $after_title;
         }
         echo '<ul class="product_list_widget">';
         while ($r->have_posts()) {
             $r->the_post();
             wc_get_template('content-widget-product.php');
         }
         echo '</ul>';
         echo $after_widget;
     }
     wp_reset_postdata();
     $content = ob_get_clean();
     echo $content;
 }
开发者ID:k2jysy,项目名称:mergeshop,代码行数:41,代码来源:widget-recent-reviews.php


示例7: output

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


示例8: nm_ajax_add_to_cart_redirect_template

function nm_ajax_add_to_cart_redirect_template()
{
    if (isset($_REQUEST['nm-ajax-add-to-cart'])) {
        wc_get_template('ajax-add-to-cart-fragments.php');
        exit;
    }
}
开发者ID:tccyp001,项目名称:onemore-wordpress,代码行数:7,代码来源:woocommerce.php


示例9: view

 /**
  * Shortcode view
  *
  * @return string
  */
 private function view()
 {
     ob_start();
     // load template file via WooCommerce template function
     wc_get_template('lost-license-form.php', array(), 'license-wp', license_wp()->service('file')->plugin_path() . '/templates/');
     return ob_get_clean();
 }
开发者ID:ChromeOrange,项目名称:license-wp,代码行数:12,代码来源:LostLicenseForm.php


示例10: widget

 /**
  * widget function.
  *
  * @see WP_Widget
  * @access public
  * @param array $args
  * @param array $instance
  * @return void
  */
 public function widget($args, $instance)
 {
     if ($this->get_cached_widget($args)) {
         return;
     }
     ob_start();
     extract($args);
     if (function_exists('icl_register_string')) {
         icl_register_string('MediaCenter', 'Tab #1 title ' . $this->widget_id, $instance['title_tab_1']);
         icl_register_string('MediaCenter', 'Tab #2 title ' . $this->widget_id, $instance['title_tab_2']);
         icl_register_string('MediaCenter', 'Tab #3 title ' . $this->widget_id, $instance['title_tab_3']);
     }
     if (function_exists('icl_t')) {
         $instance['title_tab_1'] = icl_t('MediaCenter', 'Tab #1 title ' . $this->widget_id, $instance['title_tab_1']);
         $instance['title_tab_2'] = icl_t('MediaCenter', 'Tab #2 title ' . $this->widget_id, $instance['title_tab_2']);
         $instance['title_tab_3'] = icl_t('MediaCenter', 'Tab #3 title ' . $this->widget_id, $instance['title_tab_3']);
     }
     $vars['title_tab_1'] = apply_filters('widget_text', $instance['title_tab_1']);
     $sc_tab_1 = $instance['content_tab_1'];
     $vars['title_tab_2'] = apply_filters('widget_text', $instance['title_tab_2']);
     $sc_tab_2 = $instance['content_tab_2'];
     $vars['title_tab_3'] = apply_filters('widget_text', $instance['title_tab_3']);
     $sc_tab_3 = $instance['content_tab_3'];
     echo $before_widget;
     $vars['content_tab_1'] = do_shortcode('[' . $sc_tab_1 . ' product_item_size="size-medium" screen_width="100" per_page="4"]');
     $vars['content_tab_2'] = do_shortcode('[' . $sc_tab_2 . ' product_item_size="size-medium" screen_width="100" per_page="4"]');
     $vars['content_tab_3'] = do_shortcode('[' . $sc_tab_3 . ' product_item_size="size-medium" screen_width="100" per_page="4"]');
     echo wc_get_template('framework/templates/widgets/home-page-tabs.php', $vars);
     echo $after_widget;
     $content = ob_get_clean();
     echo $content;
     $this->cache_widget($args, $content);
 }
开发者ID:Qualitair,项目名称:ecommerce,代码行数:42,代码来源:class-mc-widget-home-tabs.php


示例11: output

 /**
  * Output the shortcode.
  *
  * @param array $atts
  */
 public static function output($atts)
 {
     // Check cart class is loaded or abort
     if (is_null(WC()->cart)) {
         return;
     }
     extract(shortcode_atts(array(), $atts));
     global $post;
     if (!empty($_REQUEST['orderid']) && isset($_POST['_wpnonce']) && wp_verify_nonce($_POST['_wpnonce'], 'woocommerce-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 = wc_get_order(apply_filters('woocommerce_shortcode_order_tracking_order_id', $order_id));
             if ($order && $order->get_id() && $order_email) {
                 if (strtolower($order->get_billing_email()) == strtolower($order_email)) {
                     do_action('woocommerce_track_order', $order->get_id());
                     wc_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>';
             }
         }
     }
     wc_get_template('order/form-tracking.php');
 }
开发者ID:tlovett1,项目名称:woocommerce,代码行数:35,代码来源:class-wc-shortcode-order-tracking.php


示例12: widget

 /**
  * widget function.
  *
  * @see WP_Widget
  *
  * @param array $args
  * @param array $instance
  *
  * @return void
  */
 public function widget($args, $instance)
 {
     if ($this->get_cached_widget($args)) {
         return;
     }
     ob_start();
     $number = !empty($instance['number']) ? absint($instance['number']) : $this->settings['number']['std'];
     add_filter('posts_clauses', array(WC()->query, 'order_by_rating_post_clauses'));
     $query_args = array('posts_per_page' => $number, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product');
     $query_args['meta_query'] = WC()->query->get_meta_query();
     $r = new WP_Query($query_args);
     if ($r->have_posts()) {
         $this->widget_start($args, $instance);
         echo '<ul class="product_list_widget">';
         while ($r->have_posts()) {
             $r->the_post();
             wc_get_template('content-widget-product.php', array('show_rating' => true));
         }
         echo '</ul>';
         $this->widget_end($args);
     }
     remove_filter('posts_clauses', array(WC()->query, 'order_by_rating_post_clauses'));
     wp_reset_postdata();
     $content = ob_get_clean();
     echo $content;
     $this->cache_widget($args, $content);
 }
开发者ID:abesamislyndon,项目名称:femaccms,代码行数:37,代码来源:class-wc-widget-top-rated-products.php


示例13: widget

 /**
  * Output widget.
  *
  * @see WP_Widget
  *
  * @param array $args
  * @param array $instance
  */
 public function widget($args, $instance)
 {
     if ($this->get_cached_widget($args)) {
         return;
     }
     ob_start();
     $number = !empty($instance['number']) ? absint($instance['number']) : $this->settings['number']['std'];
     $query_args = array('posts_per_page' => $number, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'meta_key' => '_wc_average_rating', 'orderby' => 'meta_value_num', 'order' => 'DESC');
     $query_args['meta_query'] = WC()->query->get_meta_query();
     $r = new WP_Query($query_args);
     if ($r->have_posts()) {
         $this->widget_start($args, $instance);
         echo apply_filters('woocommerce_before_widget_product_list', '<ul class="product_list_widget">');
         while ($r->have_posts()) {
             $r->the_post();
             wc_get_template('content-widget-product.php', array('show_rating' => true));
         }
         echo apply_filters('woocommerce_after_widget_product_list', '</ul>');
         $this->widget_end($args);
     }
     wp_reset_postdata();
     $content = ob_get_clean();
     echo $content;
     $this->cache_widget($args, $content);
 }
开发者ID:Korkey128k,项目名称:woocommerce,代码行数:33,代码来源:class-wc-widget-top-rated-products.php


示例14: widget

 /**
  * Output widget.
  *
  * @see WP_Widget
  *
  * @param array $args
  * @param array $instance
  */
 public function widget($args, $instance)
 {
     $viewed_products = !empty($_COOKIE['woocommerce_recently_viewed']) ? (array) explode('|', $_COOKIE['woocommerce_recently_viewed']) : array();
     $viewed_products = array_reverse(array_filter(array_map('absint', $viewed_products)));
     if (empty($viewed_products)) {
         return;
     }
     ob_start();
     $number = !empty($instance['number']) ? absint($instance['number']) : $this->settings['number']['std'];
     $query_args = array('posts_per_page' => $number, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'post__in' => $viewed_products, 'orderby' => 'post__in');
     if ('yes' === get_option('woocommerce_hide_out_of_stock_items')) {
         $query_args['tax_query'] = array(array('taxonomy' => 'product_visibility', 'field' => 'name', 'terms' => 'outofstock', 'operator' => 'NOT IN'));
     }
     $r = new WP_Query($query_args);
     if ($r->have_posts()) {
         $this->widget_start($args, $instance);
         echo apply_filters('woocommerce_before_widget_product_list', '<ul class="product_list_widget">');
         while ($r->have_posts()) {
             $r->the_post();
             wc_get_template('content-widget-product.php');
         }
         echo apply_filters('woocommerce_after_widget_product_list', '</ul>');
         $this->widget_end($args);
     }
     wp_reset_postdata();
     $content = ob_get_clean();
     echo $content;
 }
开发者ID:shivapoudel,项目名称:woocommerce,代码行数:36,代码来源:class-wc-widget-recently-viewed.php


示例15: my_bookings

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


示例16: display_product_block

 public function display_product_block()
 {
     global $post;
     $product = $GLOBALS['product'] = wc_get_product($post);
     $image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'post');
     $image = $image[0];
     wc_get_template('single-product/introduction.php', compact('product', 'image'));
 }
开发者ID:darbymanning,项目名称:Family-Church,代码行数:8,代码来源:ProductController.php


示例17: wcdn_get_template_content

/**
 * Output the template part
 */
function wcdn_get_template_content($name, $args = null)
{
    global $wcdn;
    $location = $wcdn->print->get_template_file_location($name);
    if ($location) {
        wc_get_template($name, $args, $location, $location);
    }
}
开发者ID:fuyuko,项目名称:woocommerce-delivery-notes,代码行数:11,代码来源:wcdn-template-functions.php


示例18: display_template

 /**
  * Add a Template
  *
  * @return  void
  * @since 0.1.0
  */
 public function display_template()
 {
     global $product;
     // load up the scripts
     $this->load_scripts();
     // display the template
     wc_get_template('single-product/sample-template.php', array('product_id' => $product->id), FALSE, WC_Extension_Boilerplate::$dir . '/templates/');
 }
开发者ID:helgatheviking,项目名称:wc-extension-boilerplate,代码行数:14,代码来源:class-wc-extension-boilerplate-display.php


示例19: print_licenses

 /**
  * Print licenses
  */
 public function print_licenses()
 {
     // get licenses of current user
     $licenses = license_wp()->service('license_manager')->get_licenses_by_user(get_current_user_id());
     if (count($licenses) > 0) {
         wc_get_template('my-licenses.php', array('licenses' => $licenses), 'license-wp', license_wp()->service('file')->plugin_path() . '/templates/');
     }
 }
开发者ID:ChromeOrange,项目名称:license-wp,代码行数:11,代码来源:MyAccount.php


示例20: 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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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