yith_wcwl_add_to_wishlist shortcode don't use the params
-
The yith_wcwl_add_to_wishlist shordcode (
YITH_WCWL_Shortcode::add_to_wishlist()
) don’t use the attributes you send with. It’s because you’re using theshortcode_atts()
in a wrong way. Remove it from the top of the method and replace$atts = array_merge( $atts, $additional_params );
with
$atts = shortcode_atts( $additional_params, $atts );
Here’s the complete code:
/** * Return "Add to Wishlist" button. * * @since 1.0.0 */ public static function add_to_wishlist( $atts, $content = null ) { global $product; $template_part = 'button'; $label_option = get_option( 'yith_wcwl_add_to_wishlist_text' ); $icon_option = get_option( 'yith_wcwl_add_to_wishlist_icon' ) != 'none' ? '<i class="' . get_option( 'yith_wcwl_add_to_wishlist_icon' ) . '"></i>' : ''; $localize_label = function_exists( 'icl_translate' ) ? icl_translate( 'Plugins', 'plugin_yit_wishlist_button', $label_option ) : $label_option; $label = apply_filters( 'yith_wcwl_button_label', $localize_label ); $icon = apply_filters( 'yith_wcwl_button_icon', $icon_option ); $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' ); $wishlist_url = YITH_WCWL()->get_wishlist_url(); $exists = YITH_WCWL()->is_product_in_wishlist( $product->id ); $product_type = $product->product_type; $additional_params = array( 'wishlist_url' => $wishlist_url, 'exists' => $exists, 'product_id' => $product->id, 'product_type' => $product_type, 'label' => $label, 'icon' => $icon, 'link_classes' => $classes, 'available_multi_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 ); // 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 ); }
Thanks ??
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘yith_wcwl_add_to_wishlist shortcode don't use the params’ is closed to new replies.