本文整理汇总了PHP中YITH_WCWL函数的典型用法代码示例。如果您正苦于以下问题:PHP YITH_WCWL函数的具体用法?PHP YITH_WCWL怎么用?PHP YITH_WCWL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了YITH_WCWL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: yith_wcwl_count_products
/**
* Retrieve the number of products in the wishlist.
*
* @return int
* @since 1.0.0
*/
function yith_wcwl_count_products()
{
return YITH_WCWL()->count_products();
}
示例2: roen_woocommerce_get_wishlist
function roen_woocommerce_get_wishlist($add_wishlist = '', $just_added = '', $view_wishlist = '', $tooltip = true)
{
global $product;
$url = YITH_WCWL()->get_wishlist_url();
$product_type = $product->product_type;
$default_wishlists = is_user_logged_in() ? YITH_WCWL()->get_wishlists(array('is_default' => true)) : false;
if (!empty($default_wishlists)) {
$default_wishlist = $default_wishlists[0]['ID'];
} else {
$default_wishlist = false;
}
$exists = YITH_WCWL()->is_product_in_wishlist($product->id, $default_wishlist);
$label = '';
$icon = '';
if ($tooltip) {
$classes = 'class="add_to_wishlist woo-show-tooltip"';
} else {
$classes = 'class="add_to_wishlist"';
}
//$classes = get_option( 'yith_wcwl_use_button' ) == 'yes' ? 'class=" product-details add_to_wishlist single_add_to_wishlist"' : 'class="add_to_wishlist product-details"';
$html = '<div class="yith-wcwl-add-to-wishlist add-to-wishlist-' . $product->id . '">';
$html .= '<div class="yith-wcwl-add-button';
// the class attribute is closed in the next row
$html .= $exists ? ' hide" style="display:none;"' : ' show"';
$html .= '><a href="' . esc_url(YITH_WCWL()->get_addtowishlist_url()) . '" data-product-id="' . $product->id . '" title="' . __('Add to wishlist', 'ROEN') . '" data-product-type="' . $product_type . '" ' . $classes . ' ><i class="fa fa-heart-o"></i>' . $add_wishlist . '<div class="ajax-loading" style="visibility:hidden"><i class="fa fa-spinner fa-spin"></i></div></a>';
$html .= '</div>';
$html .= '<div class="yith-wcwl-wishlistaddedbrowse hide" style="display:none;"><a href="' . esc_url($url) . '"><i class="fa fa-heart"></i>' . $just_added . '</a></div>';
$html .= '<div class="yith-wcwl-wishlistexistsbrowse ' . ($exists ? 'show' : 'hide') . '" style="display:' . ($exists ? 'block' : 'none') . '"><a href="' . esc_url($url) . '"><i class="fa fa-heart"></i>' . $view_wishlist . '</a></div>';
$html .= '<div class="yith-wcwl-wishlistaddresponse"></div>';
$html .= '</div>';
return $html;
}
示例3: yith_wishlist_constructor
function yith_wishlist_constructor()
{
load_plugin_textdomain('yith-woocommerce-wishlist', false, dirname(plugin_basename(__FILE__)) . '/languages/');
// Load required classes and functions
require_once YITH_WCWL_INC . 'functions.yith-wcwl.php';
require_once YITH_WCWL_INC . 'class.yith-wcwl.php';
require_once YITH_WCWL_INC . 'class.yith-wcwl-init.php';
require_once YITH_WCWL_INC . 'class.yith-wcwl-install.php';
if (is_admin()) {
require_once YITH_WCWL_INC . 'class.yith-wcwl-admin-init.php';
}
if (get_option('yith_wcwl_enabled') == 'yes') {
require_once YITH_WCWL_INC . 'class.yith-wcwl-ui.php';
require_once YITH_WCWL_INC . 'class.yith-wcwl-shortcode.php';
}
// Let's start the game!
/**
* @deprecated
*/
global $yith_wcwl;
$yith_wcwl = YITH_WCWL();
}
示例4: get_permalink
<?php
$url = get_permalink(get_option('woocommerce_myaccount_page_id'));
?>
<li><a href="<?php
echo esc_url($url);
?>
"><i class="fa fa-user"></i> <?php
esc_html_e('My Account', 'edo');
?>
</a></li>
<?php
}
?>
<?php
if (edo_is_wc() && edo_is_wl() && is_user_logged_in()) {
$wishlist_url = YITH_WCWL()->get_wishlist_url();
?>
<li><a href="<?php
echo esc_url($wishlist_url);
?>
"><i class="fa fa-heart-o"></i> <?php
esc_html_e('My Wishlist', 'edo');
?>
</a></li>
<?php
}
?>
<?php
if (edo_is_wc()) {
?>
<?php
示例5: pbo_mtw_print_link_to_wishlist_page
function pbo_mtw_print_link_to_wishlist_page()
{
$tmpl_fn_base = 'link-to-wishlist-page.php';
$tmpl_fn = locate_template('pbo-move-to-wishlist/' . $tmpl_fn_base);
if (empty($tmpl_fn)) {
$tmpl_fn = untrailingslashit(plugin_dir_path(__FILE__)) . '/templates/' . $tmpl_fn_base;
}
$wishlist_url = YITH_WCWL()->get_wishlist_url();
$wishlist_url_label = esc_html(get_option('pbo_mtw_view_wishlist_label', __('View Wishlist', 'pbo-move-to-wishlist')));
include_once $tmpl_fn;
}
开发者ID:boguslawski-piotr,项目名称:pbo-move-to-wishlist-for-yith-woocommerce-wishlist,代码行数:11,代码来源:pbo-move-to-wishlist.php
示例6: thb_wishlist_button
function thb_wishlist_button()
{
global $product;
if (class_exists('YITH_WCWL_UI')) {
$url = YITH_WCWL()->get_wishlist_url();
$product_type = $product->product_type;
$exists = YITH_WCWL()->is_product_in_wishlist($product->id);
$classes = get_option('yith_wcwl_use_button') == 'yes' ? 'class="add_to_wishlist single_add_to_wishlist"' : 'class="add_to_wishlist"';
$html = '<div class="yith-wcwl-add-to-wishlist">';
$html .= '<div class="yith-wcwl-add-button';
// the class attribute is closed in the next row
$html .= $exists ? ' hide" style="display:none;"' : ' show"';
$html .= '><a href="' . htmlspecialchars(YITH_WCWL()->get_addtowishlist_url()) . '" data-product-id="' . $product->id . '" data-product-type="' . $product_type . '" ' . $classes . ' ><i class="fa fa-heart-o"></i><span class="text">' . __("Add to wishlist", THB_THEME_NAME) . '</span></a>';
$html .= '</div>';
$html .= '<div class="yith-wcwl-wishlistaddedbrowse hide" style="display:none;"> <a href="' . $url . '" class="add_to_wishlist"><i class="fa fa-heart"></i><span class="text">' . __("Added to wishlist", THB_THEME_NAME) . '</span></a></div>';
$html .= '<div class="yith-wcwl-wishlistexistsbrowse ' . ($exists ? 'show' : 'hide') . '" style="display:' . ($exists ? 'block' : 'none') . '"><a href="' . $url . '" class="add_to_wishlist"><i class="fa fa-heart"></i><span class="text">' . __("Added to wishlist", THB_THEME_NAME) . '</span></a></div>';
$html .= '</div>';
return $html;
}
}
示例7: wp_login_url
?>
<div class="offcanvas-user clearfix">
<?php
$login_url = wp_login_url();
$logout_url = wp_logout_url();
$register_url = wp_registration_url();
if (defined('WOOCOMMERCE_VERSION')) {
$login_url = get_permalink(get_option('woocommerce_myaccount_page_id'));
$logout_url = wp_logout_url(get_permalink(woocommerce_get_page_id('myaccount')));
}
?>
<?php
if (defined('YITH_WCWL') && defined('WOOCOMMERCE_VERSION')) {
?>
<a class="offcanvas-user-wishlist-link" href="<?php
echo esc_url(YITH_WCWL()->get_wishlist_url());
?>
"><i class="fa fa-heart-o"></i> <?php
esc_html_e('My Wishlist', 'jakiro');
?>
</a>
<?php
}
?>
<a class="offcanvas-user-account-link" href="<?php
echo esc_url($login_url);
?>
"><i class="fa fa-user"></i> <?php
if (!is_user_logged_in()) {
esc_html_e('Login', 'jakiro');
} else {
示例8: add_to_wishlist
/**
* Return "Add to Wishlist" button.
*
* @since 1.0.0
*/
public static function add_to_wishlist($atts, $content = null)
{
global $product;
if (!isset($product)) {
$product = isset($atts['product_id']) ? wc_get_product($atts['product_id']) : false;
}
$template_part = 'button';
$label_option = get_option('yith_wcwl_add_to_wishlist_text');
$icon_option = get_option('yith_wcwl_add_to_wishlist_icon') != 'none' ? get_option('yith_wcwl_add_to_wishlist_icon') : '';
$label = apply_filters('yith_wcwl_button_label', $label_option);
$icon = apply_filters('yith_wcwl_button_icon', $icon_option);
$browse_wishlist = get_option('yith_wcwl_browse_wishlist_text');
$already_in_wishlist = get_option('yith_wcwl_already_in_wishlist_text');
$product_added = get_option('yith_wcwl_product_added_text');
$classes = apply_filters('yith_wcwl_add_to_wishlist_button_classes', get_option('yith_wcwl_use_button') == 'yes' ? 'add_to_wishlist single_add_to_wishlist button alt' : 'add_to_wishlist');
$default_wishlists = is_user_logged_in() ? YITH_WCWL()->get_wishlists(array('is_default' => true)) : false;
if (!empty($default_wishlists)) {
$default_wishlist = $default_wishlists[0]['ID'];
} else {
$default_wishlist = false;
}
$exists = YITH_WCWL()->is_product_in_wishlist($product->id, $default_wishlist);
$wishlist_url = YITH_WCWL()->get_wishlist_url();
$product_type = $product->product_type;
$additional_params = array('wishlist_url' => $wishlist_url, 'exists' => $exists, 'product_id' => $product->id, 'product_type' => $product_type, 'label' => $label, 'browse_wishlist_text' => $browse_wishlist, 'already_in_wishslist_text' => $already_in_wishlist, 'product_added_text' => $product_added, 'icon' => $icon, 'link_classes' => $classes, 'available_multi_wishlist' => false, 'disable_wishlist' => false);
$additional_params = apply_filters('yith_wcwl_add_to_wishlist_params', $additional_params);
$additional_params['template_part'] = isset($additional_params['template_part']) ? $additional_params['template_part'] : $template_part;
$atts = shortcode_atts($additional_params, $atts);
$atts['icon'] = !empty($atts['icon']) ? '<i class="fa ' . $atts['icon'] . '"></i>' : '';
// adds attributes list to params to extract in template, so it can be passed through a new get_template()
$atts['atts'] = $atts;
$template = yith_wcwl_get_template('add-to-wishlist.php', $atts, true);
return apply_filters('yith_wcwl_add_to_wishlisth_button_html', $template, $wishlist_url, $product_type, $exists);
}
示例9: st_wishlist_button
function st_wishlist_button($extra_class = "")
{
global $product, $yith_wcwl;
$button_type = ot_get_option('button_type');
if (class_exists('YITH_WCWL_UI')) {
$product_type = $product->product_type;
$tooltip = __("Add to wishlist", "SimThemes");
//Check Wishlist version
if (version_compare(get_option('yith_wcwl_version'), "2.0") >= 0) {
$url = YITH_WCWL()->get_wishlist_url('');
$default_wishlists = is_user_logged_in() ? YITH_WCWL()->get_wishlists(array('is_default' => true)) : false;
if (!empty($default_wishlists)) {
$default_wishlist = $default_wishlists[0]['ID'];
} else {
$default_wishlist = false;
}
$exists = YITH_WCWL()->is_product_in_wishlist($product->id, $default_wishlist);
} else {
$url = $yith_wcwl->get_wishlist_url('');
$exists = $yith_wcwl->is_product_in_wishlist($product->id);
}
if ($exists) {
$tooltip = __("View wishlist", "SimThemes");
}
$classes = 'class="add_to_wishlist btn btn-primary btn-lg st_woo_button product_type_simple"';
$html = '<div class="yith-wcwl-add-to-wishlist ' . $extra_class . '" data-toggle="tooltip" data-placement="top" title="' . $tooltip . '">';
$html .= '<div class="yith-wcwl-add-button';
// the class attribute is closed in the next row
$html .= $exists ? ' hide" style="display:none;"' : ' show"';
$html .= '><a href="' . htmlspecialchars($yith_wcwl->get_addtowishlist_url()) . '" data-ajaxurl="' . admin_url('admin-ajax.php') . '" data-product-id="' . $product->id . '" data-product-type="' . $product_type . '" ' . $classes . ' >';
$html .= apply_filters('st_add_to_wishlist_icon', '<i class="fa fa-heart"></i>');
$html .= '</a></div>';
$html .= '<div class="yith-wcwl-wishlistaddedbrowse hide" style="display:none;" ><a href="' . $url . '" class="btn btn-primary btn-lg st_woo_button product_type_simple ' . esc_attr($button_type) . '">';
$html .= apply_filters('st_added_to_wishlist_icon', '<i class="fa fa-check"></i>');
$html .= '</a></div>';
$html .= '<div class="yith-wcwl-wishlistexistsbrowse ' . ($exists ? 'show' : 'hide') . '" style="display:' . ($exists ? 'block' : 'none') . '"><a href="' . $url . '" class="btn btn-primary btn-lg st_woo_button ' . esc_attr($button_type) . ' product_type_simple" >';
$html .= apply_filters('st_added_to_wishlist_icon', '<i class="fa fa-check"></i>');
$html .= '</a></div>';
$html .= '<div style="clear:both"></div><div class="yith-wcwl-wishlistaddresponse"></div>';
$html .= '</div>';
return $html;
}
}
示例10: yith_wcwl_count_products
/**
* Retrieve the number of products in the wishlist.
*
* @param $wishlist_token string Optional wishlist token
*
* @return int
* @since 1.0.0
*/
function yith_wcwl_count_products($wishlist_token = false)
{
return YITH_WCWL()->count_products($wishlist_token);
}
示例11: mango_compare_wishlist_links
function mango_compare_wishlist_links($text = true)
{
//function to show wishlist and link in header
global $mango_settings;
if (function_exists('YITH_WCWL') && $mango_settings['show-wishlist-button']) {
$wishlist_url = YITH_WCWL()->get_wishlist_url();
$in = $text ? __("Wishlist", 'mango') : '(' . YITH_WCWL()->count_products() . ')';
echo '<a href="' . $wishlist_url . '" class="header-link" title="' . __("wishlist", 'mango') . '"><i class="fa fa-heart-o"></i><span class="header-text">' . $in . '</span></a>';
}
}
示例12: shop_page_wishlist_button
function shop_page_wishlist_button()
{
global $product;
global $yith_wcwl;
$default_wishlists = is_user_logged_in() ? YITH_WCWL()->get_wishlists(array('is_default' => true)) : false;
if (!empty($default_wishlists)) {
$default_wishlist = $default_wishlists[0]['ID'];
} else {
$default_wishlist = false;
}
$output = '<a href="' . esc_url(add_query_arg("add_to_wishlist", $product->id)) . '" rel="nofollow" data-product-id="' . $product->id . '" data-product-type="' . $product->product_type . '" class="add_to_wishlist shop_wishlist_button ' . ($yith_wcwl->is_product_in_wishlist($product->id, $default_wishlist) == true ? "exist_in_wishlist " : "") . '"></a>';
$output .= '<a href="' . esc_url($yith_wcwl->get_wishlist_url()) . '" rel="nofollow" class="wishlist-link shop_wishlist_button" style="' . ($yith_wcwl->is_product_in_wishlist($product->id, $default_wishlist) == true ? "display:block; " : "") . '"></a>';
$output .= '<div class="blockUI blockOverlay ui-widget-overlay ajax-loading" style="visibility:hidden;"></div>';
echo $output;
}
示例13: edo_menu_my_account
function edo_menu_my_account()
{
ob_start();
?>
<ul class="top-bar-link top-bar-link-right dot">
<?php
if (edo_is_wc() && is_user_logged_in()) {
?>
<?php
$url = get_permalink(get_option('woocommerce_myaccount_page_id'));
?>
<li><a href="<?php
echo esc_url($url);
?>
"><?php
esc_html_e('My Account', 'edo');
?>
</a></li>
<?php
}
?>
<?php
if (edo_is_wc() && edo_is_wl() && is_user_logged_in()) {
$wishlist_url = YITH_WCWL()->get_wishlist_url();
?>
<li><a href="<?php
echo esc_url($wishlist_url);
?>
"><?php
esc_html_e('My Wishlist', 'edo');
?>
</a></li>
<?php
}
?>
<?php
if (edo_is_wc()) {
?>
<?php
$check_out_url = WC()->cart->get_cart_url();
?>
<li><a href="<?php
echo esc_url($check_out_url);
?>
"><?php
esc_html_e('Checkout', 'edo');
?>
</a></li>
<?php
}
?>
<?php
if (is_user_logged_in()) {
?>
<li><a href="<?php
echo wp_logout_url();
?>
"><?php
esc_html_e('Logout', 'edo');
?>
</a></li>
<?php
} else {
?>
<li><a href="<?php
echo get_permalink(get_option('woocommerce_myaccount_page_id'));
?>
"><?php
esc_html_e('Login', 'edo');
?>
</a></li>
<?php
}
?>
<?php
if (edo_is_wc() && edo_is_cp()) {
global $yith_woocompare;
$count = count($yith_woocompare->obj->products_list);
?>
<li><a class="yith-woocompare-open" href="#"><?php
esc_html_e("Compare", 'edo');
?>
</a></li>
<?php
}
?>
</ul>
<?php
$return = ob_get_contents();
ob_clean();
echo apply_filters('edo_menu_my_account', $return);
}
示例14: yith_wcwl_count_add_to_wishlist
/**
* Count number of times a product was added to users wishlists
*
* @return int Number of times the product was added to wishlists
* @since 2.0.13
*/
function yith_wcwl_count_add_to_wishlist($product_id = false)
{
return YITH_WCWL()->count_add_to_wishlist($product_id);
}
示例15: kt_myaccount_menu_link
function kt_myaccount_menu_link($items, $args)
{
$kt_enable_myaccount_box = kt_option('kt_enable_myaccount_box', 'enable');
if ($kt_enable_myaccount_box == 'disable') {
return $items;
}
ob_start();
if ($args->theme_location == 'topbar_menuright') {
?>
<?php
if (kt_is_wc()) {
?>
<?php
$myaccount_page_id = get_option('woocommerce_myaccount_page_id');
$myaccount_link = get_permalink(get_option('woocommerce_myaccount_page_id'));
?>
<?php
if (is_user_logged_in()) {
?>
<?php
if ($myaccount_page_id) {
$logout_url = wp_logout_url(get_permalink(woocommerce_get_page_id('shop')));
if (get_option('woocommerce_force_ssl_checkout') == 'yes') {
$logout_url = str_replace('http:', 'https:', $logout_url);
}
}
?>
<li class="menu-item menu-item-has-children">
<a href="<?php
echo esc_url($myaccount_link);
?>
"><?php
_e('My Account', 'kutetheme');
?>
</a>
<ul class="sub-menu">
<?php
if (function_exists('YITH_WCWL')) {
$wishlist_url = YITH_WCWL()->get_wishlist_url();
?>
<li><a href="<?php
echo esc_attr($wishlist_url);
?>
"><?php
_e('Wishlists', 'kutetheme');
?>
</a></li>
<?php
}
?>
<?php
if (defined('YITH_WOOCOMPARE')) {
global $yith_woocompare;
$count = count($yith_woocompare->obj->products_list);
?>
<li><a href="#" class="yith-woocompare-open"><?php
esc_html_e("Compare", 'kutetheme');
?>
<span>(<?php
echo esc_attr($count);
?>
)</span></a></li>
<?php
}
?>
<?php
if (isset($logout_url) && $logout_url) {
?>
<li><a href="<?php
echo esc_url($logout_url);
?>
"><?php
_e('Logout', 'kutetheme');
?>
</a></li>
<?php
}
?>
</ul>
</li>
<?php
} else {
?>
<li class="menu-item login-item"><a href="<?php
echo esc_url($myaccount_link);
?>
"><?php
_e('Login/Register', 'kutetheme');
?>
</a></li>
<?php
}
?>
<?php
}
?>
<?php
}
$item = ob_get_contents();
$items = $item . $items;
//.........这里部分代码省略.........