本文整理汇总了PHP中is_woocommerce_active函数的典型用法代码示例。如果您正苦于以下问题:PHP is_woocommerce_active函数的具体用法?PHP is_woocommerce_active怎么用?PHP is_woocommerce_active使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_woocommerce_active函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* The constructor
*/
public function __construct()
{
if (is_woocommerce_active() && version_compare(WC()->version, '2.2.0', '>=')) {
$this->setup();
} else {
add_action('admin_notices', array($this, 'notice_wc_required'));
}
}
示例2: ux_woocommerce_version_check
function ux_woocommerce_version_check($version = '2.1')
{
if (function_exists('is_woocommerce_active') && is_woocommerce_active()) {
global $woocommerce;
if (version_compare($woocommerce->version, $version, ">=")) {
return true;
}
}
return false;
}
示例3: rtwoo_gitlab_woo_check
function rtwoo_gitlab_woo_check()
{
if (!function_exists('woothemes_queue_update')) {
require_once 'woo-includes/woo-functions.php';
}
if (is_woocommerce_active()) {
return true;
} else {
return false;
}
}
示例4: __construct
/**
* init
*
* @access public
* @since 1.0.0
* @return bool
*/
public function __construct()
{
self::$_this = $this;
add_action('init', array($this, 'load_plugin_textdomain'));
// Required functions
require_once 'woo-includes/woo-functions.php';
if (is_woocommerce_active()) {
if (is_admin()) {
include_once 'includes/class-wc-geolocation-based-products-admin.php';
add_filter('plugin_action_links_' . plugin_basename(__FILE__), array($this, 'action_links'));
} else {
include_once 'includes/class-wc-geolocation-based-products-frontend.php';
}
} else {
add_action('admin_notices', array($this, 'woocommerce_missing_notice'));
}
return true;
}
开发者ID:wir,项目名称:woocommerce-geolocation-based-products,代码行数:25,代码来源:woocommerce-geolocation-based-products.php
示例5: add_my_sidebars
/**
* Register sidebars for Carpress
*
* @package Carpress
*/
function add_my_sidebars()
{
// blog sidebar
if (function_exists('ot_get_option')) {
$blog = ot_get_option('blog_layout', 'no');
}
if ("no" != $blog) {
register_sidebar(array('name' => _x('Blog Sidebar', 'backend', 'carpress_wp'), 'id' => 'blog-sidebar', 'description' => _x('Sidebar in the blog layout', 'backend', 'carpress_wp'), 'class' => 'blog sidebar', 'before_widget' => '<div id="%1$s" class="sidebar-item %2$s">', 'after_widget' => '</div>', 'before_title' => '<div class="lined">', 'after_title' => '<span class="bolded-line"></span></div>'));
}
// services sidebar
if (function_exists('ot_get_option')) {
$services = ot_get_option('services_layout', 'no');
}
if ("no" != $services) {
register_sidebar(array('name' => _x('Services Sidebar', 'backend', 'carpress_wp'), 'id' => 'services-sidebar', 'description' => _x('Sidebar in the services layout', 'backend', 'carpress_wp'), 'class' => 'services sidebar', 'before_widget' => '<div id="%1$s" class="sidebar-item %2$s">', 'after_widget' => '</div>', 'before_title' => '<div class="lined">', 'after_title' => '<span class="bolded-line"></span></div>'));
}
// gallery sidebar
if (function_exists('ot_get_option')) {
$services = ot_get_option('gallery_layout', 'no');
}
if ("no" != $services) {
register_sidebar(array('name' => _x('Gallery Sidebar', 'backend', 'carpress_wp'), 'id' => 'gallery-sidebar', 'description' => _x('Sidebar in the gallery layout', 'backend', 'carpress_wp'), 'class' => 'gallery sidebar', 'before_widget' => '<div id="%1$s" class="sidebar-item %2$s">', 'after_widget' => '</div>', 'before_title' => '<div class="lined">', 'after_title' => '<span class="bolded-line"></span></div>'));
}
// woocommerce shop sidebar
if (is_woocommerce_active()) {
register_sidebar(array('name' => _x('Shop Sidebar', 'backend', 'carpress_wp'), 'id' => 'shop-sidebar', 'description' => _x('Sidebar for the shop page', 'backend', 'carpress_wp'), 'class' => 'left sidebar', 'before_widget' => '<div class="sidebar-item %2$s">', 'after_widget' => '</div>', 'before_title' => '<div class="lined">', 'after_title' => '<span class="bolded-line"></span></div>'));
}
// contact page
register_sidebar(array('name' => _x('Contact Page Sidebar', 'backend', 'carpress_wp'), 'id' => 'contact-sidebar', 'description' => _x('Sidebar on the contact us and make an appointment page', 'backend', 'carpress_wp'), 'class' => 'contact-us sidebar', 'before_widget' => '<div id="%1$s" class="sidebar-item %2$s">', 'after_widget' => '</div>', 'before_title' => '<div class="lined">', 'after_title' => '<span class="bolded-line"></span></div>'));
// regular page
register_sidebar(array('name' => _x('Regular Page Sidebar', 'backend', 'carpress_wp'), 'id' => 'regular-page-sidebar', 'description' => _x('Sidebar on the regular page', 'backend', 'carpress_wp'), 'class' => 'regular-page sidebar', 'before_widget' => '<div id="%1$s" class="sidebar-item %2$s">', 'after_widget' => '</div>', 'before_title' => '<div class="lined">', 'after_title' => '<span class="bolded-line"></span></div>'));
// opening time above the slider
register_sidebar(array('name' => _x('Opening Time in Jumbotron', 'backend', 'carpress_wp'), 'id' => 'above-slider', 'description' => _x('Widget area in the jumbotron on the homepage for opening times', 'backend', 'carpress_wp'), 'before_widget' => '<div id="%1$s" class="%2$s">', 'after_widget' => '</div>', 'before_title' => '', 'after_title' => ''));
// widgets at the bottom of the jumbotron
register_sidebar(array('name' => _x('Jumbotron Widgets', 'backend', 'carpress_wp'), 'id' => 'jumbotron-bottom', 'description' => _x('Widget area for three widgets in the jumbotron on the homepage', 'backend', 'carpress_wp'), 'before_widget' => '<div id="%1$s" class="%2$s widget clearfix">', 'after_widget' => '</div>', 'before_title' => '', 'after_title' => ''));
// home page - above maps
register_sidebar(array('name' => _x('Home Page - above Google maps', 'backend', 'carpress_wp'), 'id' => 'home-above-map', 'description' => _x('Sidebar above the Google maps on the homepage', 'backend', 'carpress_wp'), 'before_widget' => '<div class="span3"><div class="%2$s">', 'after_widget' => '</div></div>', 'before_title' => '<div class="lined">', 'after_title' => '<span class="bolded-line"></span></div>'));
// home page - under Google maps
register_sidebar(array('name' => _x('Home Page - under Google maps', 'backend', 'carpress_wp'), 'id' => 'home-under-map', 'description' => _x('Sidebar under the Google maps on the homepage', 'backend', 'carpress_wp'), 'before_widget' => '<div class="span3"><div class="%2$s">', 'after_widget' => '</div></div>', 'before_title' => '<div class="lined">', 'after_title' => '<span class="bolded-line"></span></div>'));
// footer
register_sidebar(array('name' => _x('Footer', 'backend', 'carpress_wp'), 'id' => 'footer-sidebar-area', 'description' => _x('Sidebar in the dark area at the bottom of the website', 'backend', 'carpress_wp'), 'before_widget' => '<div class="span3"><div class="%2$s">', 'after_widget' => '</div></div>', 'before_title' => '<div class="lined">', 'after_title' => '<span class="bolded-line"></span></div>'));
}
示例6: __construct
/**
* Constructor
*/
public function __construct()
{
add_action('init', array($this, 'load_plugin_textdomain'));
if (is_woocommerce_active() && class_exists('WC_Payment_Gateway')) {
add_filter('woocommerce_payment_gateways', array($this, 'register_gateway'));
if (is_admin()) {
add_action('admin_notices', array($this, 'ssl_check'));
}
include 'includes/class-wc-gateway-paypal-pro.php';
include 'includes/class-wc-gateway-paypal-pro-payflow.php';
add_action('woocommerce_order_status_on-hold_to_processing', array($this, 'capture_payment'));
add_action('woocommerce_order_status_on-hold_to_completed', array($this, 'capture_payment'));
add_action('woocommerce_order_status_on-hold_to_cancelled', array($this, 'cancel_payment'));
add_action('woocommerce_order_status_on-hold_to_refunded', array($this, 'cancel_payment'));
add_action('admin_init', array($this, 'update_ssl_nag'));
} else {
add_action('admin_notices', array($this, 'woocommerce_missing_notice'));
}
return true;
}
示例7: __construct
/**
* Constructor
*/
public function __construct()
{
add_action('init', array($this, 'load_plugin_textdomain'));
if (is_woocommerce_active() && class_exists('WC_Payment_Gateway')) {
if (version_compare(get_option('woocommerce_paypal_pro_version', 0), self::VERSION, '<')) {
$this->update();
}
add_filter('woocommerce_payment_gateways', array($this, 'register_gateway'));
if (is_admin()) {
add_action('admin_notices', array($this, 'ssl_check'));
}
include 'includes/class-wc-gateway-paypal-pro.php';
include 'includes/class-wc-gateway-paypal-pro-payflow.php';
add_action('woocommerce_order_status_on-hold_to_processing', array($this, 'capture_payment'));
add_action('woocommerce_order_status_on-hold_to_completed', array($this, 'capture_payment'));
add_action('woocommerce_order_status_on-hold_to_cancelled', array($this, 'cancel_payment'));
add_action('woocommerce_order_status_on-hold_to_refunded', array($this, 'cancel_payment'));
add_action('admin_init', array($this, 'update_ssl_nag'));
add_action('admin_notices', array($this, 'cardinal_upgrade_notice'));
add_action('wp_ajax_dismiss-notice', array($this, 'dissmissable_notice_handler'));
} else {
add_action('admin_notices', array($this, 'woocommerce_missing_notice'));
}
}
示例8: woothemes_queue_update
* @category Importer
* @copyright Copyright (c) 2012-2014, SkyVerge, Inc.
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
if (!defined('ABSPATH')) {
exit;
}
// Exit if accessed directly
// Required functions
if (!function_exists('woothemes_queue_update')) {
require_once 'woo-includes/woo-functions.php';
}
// Plugin updates
woothemes_queue_update(plugin_basename(__FILE__), 'eb00ca8317a0f64dbe185c995e5ea3df', '18709');
// WC active check/is admin
if (!is_woocommerce_active() || !is_admin()) {
return;
}
// Required library classss
if (!class_exists('SV_WC_Framework_Bootstrap')) {
require_once 'lib/skyverge/woocommerce/class-sv-wc-framework-bootstrap.php';
}
SV_WC_Framework_Bootstrap::instance()->register_plugin('2.1', __('WooCommerce Customer/Order CSV Import', 'woocommerce-customer-order-csv-import'), __FILE__, 'init_woocommerce_customer_order_csv_import');
function init_woocommerce_customer_order_csv_import()
{
/**
* Customer/Order/Coupon CSV Import Suite Main Class. This class is responsible
* for registering the importers and setting up the admin start page/menu
* items. The actual import process is handed off to the various parse
* and import classes.
*
示例9: init_hooks
/**
* Initializes hooks
*
* @access public
* @since 1.0.0
* @version 1.0.0
* @return bool
*/
public function init_hooks()
{
register_deactivation_hook(__FILE__, array('WC_Square_Deactivation', 'deactivate'));
if (is_woocommerce_active()) {
add_filter('woocommerce_integrations', array($this, 'include_integration'));
add_action('plugins_loaded', array($this, 'load_plugin_textdomain'));
add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'));
add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_styles'));
add_action('woocommerce_square_bulk_syncing_square_to_wc', array($this->wc_to_square_wp_hooks, 'disable'));
add_action('admin_notices', array($this, 'is_connected_to_square'));
} else {
add_action('admin_notices', array($this, 'woocommerce_missing_notice'));
}
}
示例10: remove_user_from_post
public function remove_user_from_post()
{
global $woothemes_sensei;
$return = '';
// Security check
$nonce = '';
if (isset($_POST['remove_user_from_post_nonce'])) {
$nonce = esc_html($_POST['remove_user_from_post_nonce']);
}
if (!wp_verify_nonce($nonce, 'remove_user_from_post_nonce')) {
die($return);
}
// Parse POST data
$data = $_POST['data'];
$action_data = array();
parse_str($data, $action_data);
if ($action_data['user_id'] && $action_data['post_id'] && $action_data['post_type']) {
$user_id = intval($action_data['user_id']);
$post_id = intval($action_data['post_id']);
$post_type = sanitize_text_field($action_data['post_type']);
$order_id = sanitize_text_field($action_data['order_id']);
$user = get_userdata($user_id);
switch ($post_type) {
case 'course':
$removed = WooThemes_Sensei_Utils::sensei_remove_user_from_course($post_id, $user_id);
if (!empty($order_id) && is_woocommerce_active()) {
$order = new WC_Order($order_id);
if (!empty($order)) {
$order->update_status('cancelled');
}
}
break;
case 'lesson':
$removed = WooThemes_Sensei_Utils::sensei_remove_user_from_lesson($post_id, $user_id);
break;
}
if ($removed) {
$return = 'removed';
}
}
die($return);
}
示例11: woocommerce_inactive_notice
/**
* Called when WooCommerce is inactive to display an inactive notice.
*
* @since 1.2
*/
public static function woocommerce_inactive_notice()
{
if (current_user_can('activate_plugins')) {
if (!is_woocommerce_active()) {
?>
<div id="message" class="error">
<p><?php
// translators: 1$-2$: opening and closing <strong> tags, 3$-4$: link tags, takes to woocommerce plugin on wp.org, 5$-6$: opening and closing link tags, leads to plugins.php in admin
printf(esc_html__('%1$sWooCommerce Subscriptions is inactive.%2$s The %3$sWooCommerce plugin%4$s must be active for WooCommerce Subscriptions to work. Please %5$sinstall & activate WooCommerce »%6$s', 'woocommerce-subscriptions'), '<strong>', '</strong>', '<a href="http://wordpress.org/extend/plugins/woocommerce/">', '</a>', '<a href="' . esc_url(admin_url('plugins.php')) . '">', '</a>');
?>
</p>
</div>
<?php
} elseif (version_compare(get_option('woocommerce_db_version'), '2.3', '<')) {
?>
<div id="message" class="error">
<p><?php
// translators: 1$-2$: opening and closing <strong> tags, 3$-4$: opening and closing link tags, leads to plugin admin
printf(esc_html__('%1$sWooCommerce Subscriptions is inactive.%2$s This version of Subscriptions requires WooCommerce 2.3 or newer. Please %3$supdate WooCommerce to version 2.3 or newer »%4$s', 'woocommerce-subscriptions'), '<strong>', '</strong>', '<a href="' . esc_url(admin_url('plugins.php')) . '">', '</a>');
?>
</p>
</div>
<?php
}
?>
<?php
}
}
示例12: bloginfo
" alt="<?php
bloginfo('name');
?>
" /></a>
<?php
}
?>
<div class="main_navigation">
<div class="main_menu_nav_wrapper">
<?php
wp_nav_menu(array('theme_location' => 'primary_menu', 'depth' => 5, 'container' => false, 'menu_class' => 'main_menu_nav'));
?>
</div>
<?php
global $woocommerce;
if (is_woocommerce_active() && sizeof($woocommerce->cart->cart_contents) > 0) {
?>
<a href="<?php
echo esc_url($woocommerce->cart->get_cart_url());
?>
" class="cart_button"><i class="fa fa-shopping-cart"></i><span class="count"><?php
echo esc_attr($woocommerce->cart->cart_contents_count);
?>
</span></a>
<?php
}
?>
<?php
if (!get_theme_mod('search_button')) {
?>
<a href="#" data-toggle="modal" data-target="#show_search" class="search_button"><i class="fa fa-search"></i></a>
示例13: useWoo
function useWoo()
{
$ret = is_woocommerce_active() && $this->options['use_woo'] == 'on' ? true : false;
return $ret;
}
示例14: ot_get_option
<?php
if (is_home()) {
$title = ot_get_option('blog_page_title', get_bloginfo('title'));
} elseif (is_category()) {
$title = __('Category', 'carpress_wp') . ': ' . single_cat_title('', false);
} elseif (is_tag()) {
$title = __('Tag', 'carpress_wp') . ': ' . single_tag_title('', false);
} elseif (is_search()) {
$title = __('Search Results For', 'carpress_wp') . ' "' . get_search_query() . '"';
} elseif ('services' == get_post_type()) {
$title = ot_get_option('services_page_title', __('Services', 'carpress_wp'));
} elseif ('gallery' == get_post_type()) {
$title = ot_get_option('gallery_page_title', __('Gallery', 'carpress_wp'));
} elseif ('team' == get_post_type()) {
$title = ot_get_option('team_page_title', __('Meet the Team', 'carpress_wp'));
} elseif (is_woocommerce_active() && is_woocommerce()) {
ob_start();
woocommerce_page_title();
$title = ob_get_contents();
ob_end_clean();
} else {
$title = get_the_title();
}
?>
<h1><?php
echo strip_tags($title);
?>
</h1>
</div>
<?php
get_template_part('social-icons');
示例15: init_advanced_notifications
/**
* init_advanced_notifications function.
*
* @access public
* @return void
*/
function init_advanced_notifications()
{
if (is_woocommerce_active()) {
include_once 'classes/class-wc-advanced-notifications.php';
}
}