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

PHP is_product函数代码示例

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

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



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

示例1: sv_remove_product_page_skus

function sv_remove_product_page_skus($enabled)
{
    if (!is_admin() && is_product()) {
        return false;
    }
    return $enabled;
}
开发者ID:JPodz,项目名称:harlequinnejuice,代码行数:7,代码来源:functions.php


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


示例3: process_request

 public function process_request()
 {
     global $post;
     $postID = $post->ID;
     if (is_product() && isset($_GET['wsd_share'])) {
         switch ($_GET['wsd_share']) {
             case 'facebook':
                 $fb_url = $this->http() . '://www.facebook.com/sharer.php?u=' . rawurlencode(get_permalink($postID)) . '&t=' . rawurlencode($post->post_title);
                 // Redirect to Facebook
                 wp_redirect($fb_url);
                 die;
                 break;
             case 'twitter':
                 $post_title = html_entity_decode(wp_kses($post->post_title, null));
                 $post_link = get_permalink($postID);
                 $text = $post_title;
                 $url = $post_link;
                 $twitter_url = add_query_arg(urlencode_deep(array_filter(compact('text', 'url'))), 'https://twitter.com/intent/tweet');
                 // Redirect to Twitter
                 wp_redirect($twitter_url);
                 die;
                 break;
         }
     }
 }
开发者ID:amir-canteetu,项目名称:Woo_Social_Discounts,代码行数:25,代码来源:class-woo-social-discounts-public.php


示例4: sv_wc_swap_mpc_rows

/**
 * Adds JS code to footer on product pages
 * to swap width and length price calculator field rows
 *
 * This will print on any product, therefore it'd be best
 * to add some checks to ensure it prints on MPC products
 * with width and length needed fields (Area LxW measurement)
 */
function sv_wc_swap_mpc_rows()
{
    // bail if we're not on a product page
    if (!(function_exists('is_product') && is_product())) {
        return;
    }
    wc_enqueue_js('

			var  $price_calculator = $( "#price_calculator" );

			if ( $price_calculator ) {

				var $length_needed = $price_calculator.find( "label[for=length_needed]" ),
					$width_needed  = $price_calculator.find( "label[for=width_needed]" );

				if ( $length_needed && $width_needed ) {

					$length_tr = $length_needed.closest( "tr" );
					$width_tr  = $width_needed.closest( "tr" );

					$width_tr.after( $length_tr );
				}
			}

	');
}
开发者ID:skyverge,项目名称:wc-plugins-snippets,代码行数:34,代码来源:invert-needed-width-length-for-area-inputs.php


示例5: m_wedding_post_classes

function m_wedding_post_classes($classes)
{
    if (function_exists('is_woocommerce') && is_woocommerce() && !is_product()) {
        $classes[] = 'animated fadeInUp';
    }
    return $classes;
}
开发者ID:mautd29388,项目名称:naturel,代码行数:7,代码来源:css.php


示例6: set_styles

 /**
  * Enqueue CSS and custom styles.
  * @since  1.0.0
  * @return string CSS
  */
 public function set_styles($is_product_archive, $is_checkout_process)
 {
     //Shop css and hooks
     $this->shop();
     //Messages css
     $this->messages();
     if (is_product()) {
         //It's product page!
         $this->its_product();
     } else {
         if ($is_product_archive) {
             wp_localize_script('etp-script', 'sfpSettings', array('shopLayout' => $this->get('wc-shop-layout'), 'mobStore' => $this->get('wc-mob-store'), 'infiniteScroll' => $this->get('wc-infinite-scroll')));
             //It's a product archive maybe a shop
             $this->its_product_archive();
         } else {
             if ($is_checkout_process) {
                 //Enable distraction free checkout if set
                 $this->distraction_free_checkout();
                 $hide_breadcrumbs = $this->get('hide-wc-breadcrumbs-checkout');
                 $this->remove_breadcrumbs($hide_breadcrumbs);
             } else {
                 //It's checkout process page
                 $this->its_non_woocommerce_page();
             }
         }
     }
     return $this->css;
 }
开发者ID:pootlepress,项目名称:18tags-wc-add-on,代码行数:33,代码来源:class-woocommerce.php


示例7: display_bool

 /**
  * Should Display 360 or Not
  *
  * @package WooCommerce 360° Image
  * @author  Captain Theme <[email protected]>
  * @since   1.0.1
  */
 public function display_bool()
 {
     /*
      * We only want to do the following on the front-end, so rule out if it's in the admin or not
      */
     if (!is_admin()) {
         // Vars for Gallery Images
         global $post;
         $product = get_product($post);
         // Only do this for products
         if ($product) {
             $attachment_ids = $product->get_gallery_attachment_ids();
             if (is_product() && get_post_meta(get_the_ID(), 'wc360_enable', true) && $attachment_ids) {
                 $bool = true;
             } else {
                 $bool = false;
             }
         } else {
             $bool = false;
         }
     } else {
         $bool = false;
     }
     return $bool;
 }
开发者ID:rsantellan,项目名称:wordpress-ecommerce,代码行数:32,代码来源:class-wc360-display.php


示例8: jbst_layout

function jbst_layout()
{
    global $jbst_layout;
    global $jbstecommerce;
    global $post;
    if ($jbst_layout) {
        return;
    }
    /* get the page layout */
    $jbst_layout = jbst_default_page_layout;
    if (is_singular(array('page', 'post'))) {
        if (!($jbst_layout = get_post_meta($post->ID, '_cmb_page_layout', true))) {
            $jbst_layout = of_get_option('default_page_layout', jbst_default_page_layout);
        }
    } else {
        if (is_page() || is_home()) {
            $jbst_layout = of_get_option('default_page_layout', jbst_default_page_layout);
        } elseif (is_search()) {
            $jbst_layout = of_get_option('default_search_layout', jbst_default_page_layout);
        } elseif (is_archive()) {
            $jbst_layout = of_get_option('default_archive_layout', jbst_default_page_layout);
        } else {
            $jbst_layout = of_get_option('default_blog_layout', jbst_default_page_layout);
        }
        if ($jbstecommerce == true) {
            if (is_shop()) {
                $jbst_layout = of_get_option('default_shop_layout', jbst_default_page_layout);
            }
            if (is_product()) {
                $jbst_layout = of_get_option('default_product_layout', jbst_default_page_layout);
            }
        }
    }
}
开发者ID:WildCodeSchool,项目名称:projet-hopital_static,代码行数:34,代码来源:template-functions.php


示例9: awts_display_total_sales

 /**
  * Loading  functionality to user to get WooCommerce Total Sales information of the specific product.
  *
  * @return void
  */
 public function awts_display_total_sales($price = '', $product = '')
 {
     $only_backend = get_option('woo_total_sales_single_product_only_be');
     $only_single_product = get_option('woo_total_sales_single_product_only_fe');
     //check if visibile only on backend
     if (isset($only_backend) && $only_backend == 'yes') {
         if (!is_admin()) {
             return $price;
         }
     }
     //check if visibile only on single product page
     if (isset($only_single_product) && $only_single_product == 'yes') {
         if (!is_product() && !is_admin()) {
             return $price;
         }
     }
     //From admin setting
     $singular = get_option('woo_total_sales_singular');
     $plural = get_option('woo_total_sales_plural');
     $items_sold = $this->awts_get_total_sales_per_product($product->id);
     $items_sold = isset($items_sold) ? absint($items_sold->_qty) : 0;
     $price_texts = '';
     $price_texts .= $price;
     if ($items_sold != 0) {
         $price_texts .= '<div class="items-sold" ><span class="items-sold-texts" >';
         $price_texts .= sprintf(esc_html(_n(!empty($singular) ? $singular : '%d item sold', !empty($plural) ? $plural : '%d items sold', $items_sold, 'woo-total-sales')), $items_sold);
         $price_texts .= '</span></div>';
     }
     return $price_texts;
 }
开发者ID:shshanker,项目名称:woo-total-sales,代码行数:35,代码来源:awts-frontend.php


示例10: enqueue_scripts

 /**
  * enqueue_checkout_script.
  */
 public function enqueue_scripts()
 {
     if (!is_product()) {
         return;
     }
     wp_enqueue_script('wcj-product-input-fields');
 }
开发者ID:sawan34,项目名称:tanzi,代码行数:10,代码来源:class-wcj-product-input-fields.php


示例11: dt_woocommerce_init_template_config

 /**
  * Init theme config for shop.
  *
  */
 function dt_woocommerce_init_template_config($name = '')
 {
     dt_woocommerce_add_config_actions();
     if ('shop' != $name) {
         return;
     }
     $config = presscore_get_config();
     $post_id = null;
     if (is_shop()) {
         $post_id = woocommerce_get_page_id('shop');
     } else {
         if (is_cart()) {
             $post_id = woocommerce_get_page_id('cart');
         } else {
             if (is_checkout()) {
                 $post_id = woocommerce_get_page_id('checkout');
             }
         }
     }
     presscore_config_base_init($post_id);
     if (is_product_category() || is_product_tag()) {
         $post_id = woocommerce_get_page_id('shop');
         if ($post_id) {
             $config->set('post_id', $post_id);
             presscore_config_populate_sidebar_and_footer_options();
             $config->set('post_id', null);
         }
     }
     if (!is_product()) {
         add_filter('presscore_get_page_title', 'dt_woocommerce_get_page_title', 20);
     }
     // replace theme breadcrumbs
     add_filter('presscore_get_breadcrumbs-html', 'dt_woocommerce_replace_theme_breadcrumbs', 20, 2);
 }
开发者ID:noman90rauf,项目名称:wp-content,代码行数:38,代码来源:mod-wc-template-config.php


示例12: wolf_get_header_post_id

 /**
  * Get the post id to use to display a header
  * For example, if a header is set for the blog, we will use it for the archive and search page
  *
  * @return int $id
  */
 function wolf_get_header_post_id()
 {
     if (is_404() || is_page_template('page-templates/home.php')) {
         return;
     }
     $post_id = null;
     $shop_page_id = wolf_get_woocommerce_shop_page_id();
     $is_shop_page = function_exists('is_shop') ? is_shop() : false;
     $is_product_taxonomy = function_exists('is_product_taxonomy') ? is_product_taxonomy() : false;
     $is_single_product = function_exists('is_product') ? is_product() : false;
     // is blog
     if (get_option('page_for_posts') && wolf_is_blog() && false == $is_shop_page && false == $is_product_taxonomy) {
         $post_id = get_option('page_for_posts');
         // if woocommerce
     } elseif ($is_shop_page || $is_product_taxonomy) {
         $post_id = $shop_page_id;
         // is single product
     } elseif ($is_single_product) {
         if (get_post_meta(get_the_ID(), '_header_bg_img', true) || get_post_meta(get_the_ID(), '_header_bg_color', true)) {
             $post_id = get_the_ID();
         } else {
             $post_id = $shop_page_id;
         }
     } else {
         $post_id = get_the_ID();
     }
     return $post_id;
 }
开发者ID:estrategasdigitales,项目名称:dictobas,代码行数:34,代码来源:single-post-options-css.php


示例13: is_embedded_product

 /**
  * Check if this is an embedded product - to make sure we don't mess up regular posts.
  *
  * @since 2.4.11
  * @return bool
  */
 public static function is_embedded_product()
 {
     if (function_exists('is_embed') && is_embed() && is_product()) {
         return true;
     }
     return false;
 }
开发者ID:CannedHead,项目名称:feelingsurf,代码行数:13,代码来源:class-wc-embed.php


示例14: tesseract_woocommerce_wrapper_start

function tesseract_woocommerce_wrapper_start()
{
    $layout_loop = get_theme_mod('tesseract_woocommerce_loop_layout');
    $layout_product = get_theme_mod('tesseract_woocommerce_product_layout');
    if (is_shop() || is_product_category() || is_product_tag()) {
        if ($layout_loop == 'sidebar-left' || $layout_loop == 'sidebar-right') {
            $primclass = 'with-sidebar';
            $primclass .= $layout_loop == 'sidebar-left' ? ' sidebar-left' : ' sidebar-right';
        } else {
            if ($layout_loop == 'fullwidth' || !$layout_loop) {
                $primclass = 'no-sidebar';
            }
        }
    } else {
        if (is_product()) {
            if ($layout_product == 'sidebar-left' || $layout_product == 'sidebar-right') {
                $primclass = 'with-sidebar';
                $primclass .= $layout_product == 'sidebar-left' ? ' sidebar-left' : ' sidebar-right';
            } else {
                if ($layout_product == 'fullwidth' || !$layout_product) {
                    $primclass = 'no-sidebar';
                }
            }
        } else {
            $primclass = 'sidebar-default';
        }
    }
    echo '<div id="primary" class="content-area ' . $primclass . '">';
}
开发者ID:rexcode,项目名称:rexappz-wordpress,代码行数:29,代码来源:woocommerce-functions.php


示例15: siw_remove_unnecessary_scripts

function siw_remove_unnecessary_scripts()
{
    //variatie als radiobuttons
    if (!is_product()) {
        wp_dequeue_script('kt-wc-add-to-cart-variation-radio');
    }
    //woocommerce ajax filter
    if (!is_shop() && !is_product_category() && !is_product_tag()) {
        wp_dequeue_script('yith-wcan-script');
        wp_dequeue_style('yith-wcan-frontend');
    }
    //woocommerce
    wp_dequeue_script('woocommerce');
    //wp-embed
    wp_deregister_script('wp-embed');
    //search&filter
    wp_dequeue_style('search-filter-chosen-styles');
    wp_dequeue_style('search-filter-plugin-styles');
    wp_deregister_script('search-filter-chosen-script');
    wp_deregister_script('jquery-ui-datepicker');
    wp_deregister_script('search-filter-plugin-build');
    wp_register_script('search-filter-plugin-build', plugins_url('search-filter-pro/public/assets/js/search-filter-build.min.js'), array('jquery'), '', TRUE);
    //kadence slider wordt alleen gebruikt op de homepage.
    if (!is_front_page()) {
        wp_dequeue_script('kadence_slider_js');
        wp_dequeue_style('kadence_slider_css');
    }
    //ncf font
    wp_dequeue_style('ncf_lato_font');
    //styling van mailpoet widget
    wp_deregister_style('validate-engine-css');
}
开发者ID:siwvolunteers,项目名称:siw,代码行数:32,代码来源:siw-js-css.php


示例16: dt_woocommerce_body_class

 /**
  * Body classes filter.
  * 
  * @param  array $classes
  * @return array
  */
 function dt_woocommerce_body_class($classes)
 {
     if (is_product() && 'disabled' !== presscore_get_config()->get('header_title')) {
         $classes[] = 'hide-product-title';
     }
     return $classes;
 }
开发者ID:RDePoppe,项目名称:luminaterealestate,代码行数:13,代码来源:mod-wc-template-functions.php


示例17: rd_after_container

 function rd_after_container()
 {
     $post_sidebar = '';
     if (is_product()) {
         if (get_field('product_sidebar')) {
             $post_sidebar = get_field('product_sidebar');
         }
         if ($post_sidebar == 'sidebar_default' || empty($post_sidebar)) {
             $post_sidebar = rd_options('reedwan_woo_product_sidebar_position');
         }
     } elseif (is_shop()) {
         $pageID = get_option('woocommerce_shop_page_id');
         if (get_field('page_sidebar', $pageID)) {
             $post_sidebar = get_field('page_sidebar', $pageID);
         }
         if ($post_sidebar == 'sidebar_default' || empty($post_sidebar)) {
             $post_sidebar = rd_options('reedwan_woo_archive_sidebar_position');
         }
     } elseif (is_product_category() || is_product_tag()) {
         $post_sidebar = rd_options('reedwan_woo_archive_sidebar_position');
     } else {
         $post_sidebar = 'sidebar_none';
     }
     echo '</div>';
     if ($post_sidebar != 'sidebar_none') {
         echo '<div class="sidebar grid_3">';
         if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('woo-sidebar')) {
         }
         echo '</div>';
     }
     echo '</div></div></div>';
 }
开发者ID:devmoonshine,项目名称:development,代码行数:32,代码来源:woo_config.php


示例18: meso_close_jigoshop_content_wrappers

function meso_close_jigoshop_content_wrappers()
{
    if (is_product()) {
        echo '</div>';
    }
    echo '</div></div>';
}
开发者ID:jun200,项目名称:wordpress,代码行数:7,代码来源:jigoshop-theme-functions.php


示例19: init

 function init()
 {
     if (!is_product()) {
         add_action('wp_footer', array($this, 'print_footer_scrips'), 99);
         add_filter('woocommerce_product_gallery_attachment_ids', array($this, 'add_featured_image_to_thumbnails'));
     }
 }
开发者ID:olleka,项目名称:WooCommerce-Better-Product-Thumbnail-Navigation,代码行数:7,代码来源:woocommerce-better-product-thumbnail-navigation.php


示例20: wcva_register_my_scripts

 public function wcva_register_my_scripts()
 {
     global $post, $product;
     if (!$post) {
         return;
     }
     $displaytypenumber = 0;
     $product = get_product($post->ID);
     if (is_product()) {
         $displaytypenumber = wcva_return_displaytype_number($product, $post);
     }
     wp_register_style('wcva-frontend', wcva_PLUGIN_URL . 'css/front-end.css');
     $goahead = 1;
     if (isset($_SERVER['HTTP_USER_AGENT'])) {
         $agent = $_SERVER['HTTP_USER_AGENT'];
     }
     if (preg_match('/(?i)msie [5-8]/', $agent)) {
         $goahead = 0;
     }
     if ($displaytypenumber > 0 && $goahead == 1) {
         wp_deregister_script('wc-add-to-cart-variation');
         wp_dequeue_script('wc-add-to-cart-variation');
         wp_register_script('wc-add-to-cart-variation', wcva_PLUGIN_URL . 'js/manage-variation-selection.js', array('jquery'), false, true);
     }
     if (is_product()) {
         if ($displaytypenumber > 0 && $goahead == 1) {
             wp_enqueue_script('wc-add-to-cart-variation');
         }
         wp_enqueue_style('wcva-frontend');
     }
 }
开发者ID:rinodung,项目名称:live-theme,代码行数:31,代码来源:class_wcva_register_scripts_styles.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP is_product_category函数代码示例发布时间:2022-05-15
下一篇:
PHP is_process_running函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap