本文整理汇总了PHP中yith_wcwl_count_products函数的典型用法代码示例。如果您正苦于以下问题:PHP yith_wcwl_count_products函数的具体用法?PHP yith_wcwl_count_products怎么用?PHP yith_wcwl_count_products使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了yith_wcwl_count_products函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: widget
function widget($args, $instance)
{
global $post;
extract($args);
global $woocommerce;
global $yith_wcwl;
// Our variables from the widget settings
$type = isset($instance['type']) ? esc_attr($instance['type']) : '';
// Before widget (defined by theme functions file)
echo $before_widget;
?>
<?php
if (class_exists('YITH_WCWL')) {
?>
<a href="<?php
echo esc_url($yith_wcwl->get_wishlist_url());
?>
" class="tools_button <?php
if ($type == 'light') {
?>
light <?php
}
?>
">
<span class="wishlist_items_number"><?php
echo yith_wcwl_count_products();
?>
</span>
</a>
<?php
}
?>
<?php
// After widget (defined by theme functions file)
echo $after_widget;
}
示例2: unset
if (isset($_POST['gform_form_id'])) {
unset($_POST['gform_form_id']);
}
// Handles all ajax requests pertaining to this plugin
require_once 'safe-wp-load.php';
require_once 'functions.yith-wcwl.php';
header("Cache-Control: no-cache, must-revalidate");
// HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
// Date in the past
if (!isset($yith_wcwl)) {
$yith_wcwl = new YITH_WCWL($_REQUEST);
}
// Remove product from the wishlist
if ($_GET['action'] == 'remove_from_wishlist') {
$count = yith_wcwl_count_products();
if ($yith_wcwl->remove($_GET['wishlist_item_id'])) {
_e('Product successfully removed.', 'yit');
} else {
echo '#' . $count . '#';
_e('Error. Unable to remove the product from the wishlist.', 'yit');
}
if (!$count) {
_e('No products were added to the wishlist', 'yit');
}
wp_redirect($yith_wcwl->get_wishlist_url());
die;
} elseif ($_GET['action'] == 'add_to_wishlist') {
$return = $yith_wcwl->add();
if ($return == 'true') {
echo $return . '##' . __('Product added!', 'yit');
示例3: esc_url
if (isset($shopkeeper_theme_options['main_header_wishlist_icon']['url']) && $shopkeeper_theme_options['main_header_wishlist_icon']['url'] != "") {
?>
<img src="<?php
echo esc_url($shopkeeper_theme_options['main_header_wishlist_icon']['url']);
?>
">
<?php
} else {
?>
<i class="fa fa-heart-o"></i>
<?php
}
?>
</span>
<span class="wishlist_items_number"><?php
echo yith_wcwl_count_products();
?>
</span>
</a>
</li>
<?php
}
?>
<?php
}
?>
<?php
if (class_exists('WooCommerce')) {
?>
<?php
示例4: remove_from_wishlist_ajax
/**
* AJAX: remove from wishlist action
*
* @return void
* @since 1.0.0
*/
public function remove_from_wishlist_ajax()
{
$wishlist_token = isset($this->details['wishlist_token']) ? $this->details['wishlist_token'] : false;
$count = yith_wcwl_count_products($wishlist_token);
$message = '';
if ($count != 0) {
if ($this->remove()) {
$message = apply_filters('yith_wcwl_product_removed_text', __('Product successfully removed.', 'yit'));
$count--;
} else {
$message = apply_filters('yith_wcwl_unable_to_remove_product_message', __('Error. Unable to remove the product from the wishlist.', 'yit'));
}
} else {
$message = apply_filters('yith_wcwl_no_product_to_remove_message', __('No products were added to the wishlist', 'yit'));
}
wc_add_notice($message);
$atts = array('wishlist_id' => $wishlist_token);
if (isset($this->details['pagination'])) {
$atts['pagination'] = $this->details['pagination'];
}
if (isset($this->details['per_page'])) {
$atts['per_page'] = $this->details['per_page'];
}
echo YITH_WCWL_Shortcode::wishlist($atts);
die;
}
示例5: site_url
<!-- Right Block -->
<div class="right_block">
<!-- Menu -->
<ul class="right_menu">
<li><a href="<?php
echo site_url();
?>
/my-account/">Account</a></li>
<li><a href="<?php
echo site_url();
?>
/auction/">Auction</a></li>
<?php
if (is_user_logged_in()) {
$wishlist_product_count = yith_wcwl_count_products();
?>
<li><a href="<?php
echo site_url();
?>
/wishlist/">Wishlist <?php
if ($wishlist_product_count > 0) {
echo '(' . $wishlist_product_count . ')';
}
?>
</a></li>
<li><a href="<?php
echo site_url();
?>
/my-account/customer-logout/">Logout</a></li>
示例6: refresh_wishlist_items_number
function refresh_wishlist_items_number()
{
global $yith_wcwl;
echo yith_wcwl_count_products();
die;
}
示例7: refresh_dynamic_contents
function refresh_dynamic_contents()
{
global $woocommerce, $yith_wcwl;
$data = array('cart_count_products' => $woocommerce->cart->cart_contents_count, 'wishlist_count_products' => yith_wcwl_count_products(), 'wishlist_shortcode_content' => do_shortcode('[yith_wcwl_wishlist]'));
wp_send_json($data);
}
示例8: accesspress_wcmenucart
<?php
if (is_woocommerce_activated()) {
echo accesspress_wcmenucart();
}
?>
<?php
if (function_exists('YITH_WCWL')) {
$wishlist_url = YITH_WCWL()->get_wishlist_url();
?>
<a class="quick-wishlist" href="<?php
echo $wishlist_url;
?>
" title="Wishlist">
<i class="fa fa-heart"></i>
<?php
echo "(" . yith_wcwl_count_products() . ")";
?>
</a>
<?php
}
?>
<div class="login-woocommerce">
<?php
if (is_user_logged_in()) {
global $current_user;
get_currentuserinfo();
?>
<a href="<?php
echo wp_logout_url(home_url());
?>
示例9: remove_from_wishlist_ajax
/**
* AJAX: remove from wishlist action
*
* @return void
* @since 1.0.0
*/
public function remove_from_wishlist_ajax()
{
$count = yith_wcwl_count_products();
if ($this->remove($_GET['wishlist_item_id'])) {
echo apply_filters('yith_wcwl_product_removed_text', __('Product successfully removed.', 'yit'));
} else {
echo '#' . $count . '#';
_e('Error. Unable to remove the product from the wishlist.', 'yit');
}
if (!$count) {
_e('No products were added to the wishlist', 'yit');
}
die;
}
示例10: refresh_dynamic_contents
function refresh_dynamic_contents()
{
global $woocommerce, $yith_wcwl;
$data = array('cart_count_products' => class_exists('WooCommerce') ? WC()->cart->get_cart_contents_count() : 0, 'wishlist_count_products' => class_exists('YITH_WCWL') ? yith_wcwl_count_products() : 0);
wp_send_json($data);
}
示例11: get_wishlist_quantity
function get_wishlist_quantity()
{
global $yith_wcwl;
$nonce = $_REQUEST['ajax_nonce'];
// check to see if the submitted nonce matches with the
// generated nonce we created earlier
if (!wp_verify_nonce($nonce, 'ajax-nonce')) {
die('Failed!');
}
$data = array('wishlist_count_products' => yith_wcwl_count_products());
wp_send_json($data);
}
示例12: ts_tini_wishlist
/** Tini wishlist **/
function ts_tini_wishlist()
{
if (!(ts_has_woocommerce() && class_exists('YITH_WCWL'))) {
return;
}
ob_start();
$wishlist_page_id = get_option('yith_wcwl_wishlist_page_id');
if (function_exists('icl_object_id')) {
$wishlist_page_id = icl_object_id($wishlist_page_id, 'page', true);
}
$wishlist_page = get_permalink($wishlist_page_id);
$count = yith_wcwl_count_products();
?>
<a title="<?php
esc_html_e('Wishlist', 'gon');
?>
" href="<?php
echo esc_url($wishlist_page);
?>
" class="tini-wishlist">
<?php
esc_html_e('Wishlist', 'gon');
?>
<?php
echo '(' . ($count > 0 ? zeroise($count, 2) : '0') . ')';
?>
</a>
<?php
$tini_wishlist = ob_get_clean();
return $tini_wishlist;
}