/** * Return "Add to Wishlist" button. * * @since 1.0.0 */ static function add_to_wishlist($atts, $content = null) { global $product, $yith_wcwl; $html = YITH_WCWL_UI::add_to_wishlist_button($yith_wcwl->get_wishlist_url(), $product->product_type, $yith_wcwl->is_product_in_wishlist($product->id)); $html .= YITH_WCWL_UI::popup_message(); return $html; }
function sb_wishlist_button($attr, $content = null) { global $product, $yith_wcwl; if ($yith_wcwl->is_product_in_wishlist($product->id)) { ?> <a class="product-in-wishlist" href="<?php echo esc_url($yith_wcwl->get_wishlist_url()); ?> " target="_blank"> <i class="icon-add-1"></i> <?php _e('Wishlist', 'dfd'); ?> </a> <?php } else { ?> <a class="add_to_wishlist" data-product-type="<?php echo $product->product_type; ?> " data-product-id="<?php echo $product->id; ?> " href="<?php echo esc_url($yith_wcwl->get_addtowishlist_url()); ?> "> <i class="icon-add-1"></i> <?php _e('Wishlist', 'dfd'); ?> </a> <?php echo YITH_WCWL_UI::popup_message(); } }
/** * Output wishlist button on product archive only if yith_wcwl_add_to_wishlist plugin is installed * * @since 1.2.0 * @return void */ function bearded_wishlist_button() { if (function_exists('shortcode_exists') && shortcode_exists('yith_wcwl_add_to_wishlist') && class_exists('YITH_WCWL')) { global $yith_wcwl, $product; $url = $yith_wcwl->get_wishlist_url(); $product_type = $product->product_type; $exists = $yith_wcwl->is_product_in_wishlist($product->id); $icon = '<i class="icon-star"></i>'; $classes = '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="' . esc_url($yith_wcwl->get_addtowishlist_url()) . '" data-product-id="' . $product->id . '" data-product-type="' . $product_type . '" ' . $classes . ' >' . $icon . '</a>'; $html .= '</div>'; $html .= '<div class="yith-wcwl-wishlistaddedbrowse hide" style="display:none;"><a href="' . esc_url($url) . '"><i class="icon-ok"></i></a></div>'; $html .= '<div class="yith-wcwl-wishlistexistsbrowse ' . ($exists ? 'show' : 'hide') . '" style="display:' . ($exists ? 'block' : 'none') . '"><a href="' . esc_url($url) . '"><i class="icon-ok"></i></a></div>'; $html .= '<div style="clear:both"></div><div class="yith-wcwl-wishlistaddresponse"></div>'; $html .= '</div>'; $html .= '<div class="clear"></div>'; $html .= YITH_WCWL_UI::popup_message(); echo $html; } }