Changeset 3326426
- Timestamp:
- 07/11/2025 04:59:39 PM (9 months ago)
- Location:
- wishlist-everywhere
- Files:
-
- 12 edited
-
tags/1.0.6/README.txt (modified) (1 diff)
-
tags/1.0.6/admin/partials/wishlist-everywhere-plugin-admin-display.php (modified) (7 diffs)
-
tags/1.0.6/includes/class-wishlist-everywhere-plugin.php (modified) (6 diffs)
-
tags/1.0.6/public/css/wishlist-everywhere-plugin-public.css (modified) (2 diffs)
-
tags/1.0.6/public/js/wishlist-everywhere-plugin-public.js (modified) (4 diffs)
-
tags/1.0.6/wishlist-everywhere.php (modified) (1 diff)
-
trunk/README.txt (modified) (1 diff)
-
trunk/admin/partials/wishlist-everywhere-plugin-admin-display.php (modified) (7 diffs)
-
trunk/includes/class-wishlist-everywhere-plugin.php (modified) (6 diffs)
-
trunk/public/css/wishlist-everywhere-plugin-public.css (modified) (2 diffs)
-
trunk/public/js/wishlist-everywhere-plugin-public.js (modified) (4 diffs)
-
trunk/wishlist-everywhere.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wishlist-everywhere/tags/1.0.6/README.txt
r3326402 r3326426 4 4 Requires at least: 5.0 5 5 Tested up to: 6.8 6 Stable tag: 1.0. 66 Stable tag: 1.0.7 7 7 License: GPLv2 or later 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html -
wishlist-everywhere/tags/1.0.6/admin/partials/wishlist-everywhere-plugin-admin-display.php
r3326402 r3326426 115 115 ]; 116 116 117 $wishlist_icons = [ 118 'icon_only' => 'Icon Only', 119 'text_only' => 'Text Only', 120 'icon_text' => 'Text + Icon', 121 ]; 122 117 123 118 124 unset($wishlist_post_types['attachment']); … … 143 149 } 144 150 151 if (!empty($_POST['wishlist_custom_icon'])) { 152 $wishlist_custom_icon = sanitize_text_field(wp_unslash($_POST['wishlist_custom_icon'])); 153 update_option('wishlist_custom_icon', $wishlist_custom_icon, true); 154 } 155 145 156 if (isset($_POST['wishlist_archive']) && $_POST['wishlist_archive'] === 'archive') { 146 157 update_option('wishlist_for_archive', 'archive'); … … 193 204 $wishlist_position = get_option('wishlist_archive_position'); 194 205 $wishlist_single_position = get_option('wishlist_single_position'); 206 $wishlist_icon_option = get_option('wishlist_custom_icon'); 195 207 196 208 unset($wishlist_post_types[$wishlist_post_name]); … … 200 212 $archive_position_val = ''; 201 213 $single_position_val = ''; 214 $wishlist_custom_icon = ''; 202 215 203 216 // Start building dropdown only if post types are available … … 237 250 } 238 251 252 253 if (!empty($wishlist_icons)) { 254 foreach ($wishlist_icons as $value => $label) { 255 $wishlist_custom_icon .= sprintf( 256 '<option value="%s"%s>%s</option>', 257 esc_attr($value), 258 selected($wishlist_icon_option, $value, false), 259 esc_html($label) 260 ); 261 } 262 } 239 263 240 264 echo ' … … 422 446 <div class = "row_wrapper"> 423 447 <div class = "group-wrapper"> 424 <h2>Wishlist Button Text</h2> 448 <h2>Wishlist Button Settings</h2> 449 <div class="form-group"> 450 <label>Display Style</label> 451 <select id="wishlist_custom_icon" name="wishlist_custom_icon"> 452 ' . $wishlist_custom_icon . ' 453 </select> 454 </div> 425 455 <div class="form-group"> 426 456 <label>Wishlist Button Label</label> … … 434 464 <div class = "detail-wrapper"> 435 465 <ol> 466 <li> 467 <strong>Display Style</strong><br> 468 Choose how the wishlist button appears on products: icon only, text only, or both. 469 </li> 436 470 <li> 437 471 <strong>Wishlist Button Label</strong><br> -
wishlist-everywhere/tags/1.0.6/includes/class-wishlist-everywhere-plugin.php
r3326402 r3326426 105 105 add_shortcode('wishlist_everywhere_single', array($this, 'add_wishlist_icon_to_product_single')); 106 106 } 107 107 108 $wishlist_position = get_option('wishlist_archive_position'); 108 109 if($wishlist_position == 'above_thumbnail') { … … 113 114 add_shortcode('wishlist_everywhere_archive', array($this, 'add_wishlist_icon_to_product_archive')); 114 115 } 116 115 117 add_filter('woocommerce_add_to_cart_redirect', array($this, 'custom_redirect_after_add_to_cart'), 10, 1); 116 118 add_shortcode('wishlist_everywhere', [$this, 'display_wishlist_page']); … … 124 126 } 125 127 add_action('wp_head',[$this,'add_wishlist_custom_css']); 128 add_action('wp_footer',[$this,'wishlist_everywhere_js_data']); 126 129 127 130 } … … 584 587 // Choose class for position 585 588 $position_class = $wishlist_position === 'above_thumbnail' ? 'above_thumbnail' : 'no_thumbnail'; 586 589 $wishlist_icon_option = get_option('wishlist_custom_icon'); 587 590 if ($required_login === 'required_login') { 588 591 // Only for logged-in users 589 592 if (is_user_logged_in()) { 590 $wishlist_icon = '<div class="shop_wishlist_wrap ' . esc_attr($position_class) . '"> 591 <a href="#" class="wishlist-icon archive" data-post-id="' . esc_attr(get_the_ID()) . '">' . esc_html($wishlist_title) . '</a> 592 </div>'; 593 echo wp_kses_post($wishlist_icon); 593 if($wishlist_icon_option === 'text_only'){ 594 $wishlist_icon = '<div class="shop_wishlist_wrap ' . esc_attr($position_class) . '"> 595 <a href="#" class="wishlist-icon archive" data-post-id="' . esc_attr(get_the_ID()) . '">' . esc_html($wishlist_title) . '</a> 596 </div>'; 597 echo wp_kses_post($wishlist_icon); 598 }else if($wishlist_icon_option === 'icon_only'){ 599 $wishlist_icon = '<div class="shop_wishlist_wrap ' . esc_attr($position_class) . '"> 600 <a href="#" class="wishlist-icon archive" data-post-id="' . esc_attr(get_the_ID()) . '"><i class="fa-regular fa-heart"></i></a> 601 </div>'; 602 echo wp_kses_post($wishlist_icon); 603 }else{ 604 $wishlist_icon = '<div class="shop_wishlist_wrap ' . esc_attr($position_class) . '"> 605 <a href="#" class="wishlist-icon archive" data-post-id="' . esc_attr(get_the_ID()) . '"> <i class="fa-regular fa-heart"></i>' . esc_html($wishlist_title) . '</a> 606 </div>'; 607 echo wp_kses_post($wishlist_icon); 608 } 609 610 594 611 } else { 595 612 // Get the current URL to redirect back after login … … 619 636 $added_class = ' added'; 620 637 } 621 622 $wishlist_icon = '<div class="shop_wishlist_wrap ' . esc_attr($position_class) . '"> 623 <a href="#" class="wishlist-icon archive' . esc_attr($added_class) . '" data-post-id="' . esc_attr(get_the_ID()) . '">' . esc_html($wishlist_title) . '</a> 624 </div>'; 625 626 echo wp_kses_post($wishlist_icon); 638 if($wishlist_icon_option === 'text_only'){ 639 $wishlist_icon = '<div class="shop_wishlist_wrap ' . esc_attr($position_class) . '"> 640 <a href="#" class="wishlist-icon archive' . esc_attr($added_class) . '" data-post-id="' . esc_attr(get_the_ID()) . '">' . esc_html($wishlist_title) . '</a> 641 </div>'; 642 echo wp_kses_post($wishlist_icon); 643 }else if($wishlist_icon_option === 'icon_only'){ 644 $wishlist_icon = '<div class="shop_wishlist_wrap ' . esc_attr($position_class) . '"> 645 <a href="#" class="wishlist-icon archive' . esc_attr($added_class) . '" data-post-id="' . esc_attr(get_the_ID()) . '"><i class="fa-regular fa-heart"></i></a> 646 </div>'; 647 echo wp_kses_post($wishlist_icon); 648 }else{ 649 $wishlist_icon = '<div class="shop_wishlist_wrap ' . esc_attr($position_class) . '"> 650 <a href="#" class="wishlist-icon archive' . esc_attr($added_class) . '" data-post-id="' . esc_attr(get_the_ID()) . '"> <i class="fa-regular fa-heart"></i> ' . esc_html($wishlist_title) . '</a> 651 </div>'; 652 echo wp_kses_post($wishlist_icon); 653 } 654 627 655 } 628 656 } … … 823 851 echo do_shortcode('[wishlist_everywhere post_type = "product"]'); 824 852 } 853 854 function wishlist_everywhere_js_data() { 855 if (is_user_logged_in()) { 856 global $wpdb; 857 $user_id = get_current_user_id(); 858 $table = $wpdb->prefix . 'cstmwishlist'; 859 860 $ids = $wpdb->get_col($wpdb->prepare("SELECT post_id FROM {$table} WHERE user_id = %d", $user_id)); 861 echo '<script>var wishlistPostIds = ' . json_encode($ids) . ';</script>'; 862 } else { 863 echo '<script>var wishlistPostIds = [];</script>'; 864 } 825 865 } 866 } -
wishlist-everywhere/tags/1.0.6/public/css/wishlist-everywhere-plugin-public.css
r3326402 r3326426 266 266 margin-top: 0; 267 267 position: relative; 268 display: flex; 269 align-items: center; 270 gap: 7px; 268 271 } 269 272 .no_thumbnail .wishlist-icon.archive { … … 272 275 margin-top: 10px; 273 276 } 277 278 @media screen and (max-width:767px) { 279 .wishlist-tab-content { 280 overflow: scroll; 281 } 282 .wishlist-table th, .wishlist-table td { 283 width: max-content; 284 white-space: nowrap; 285 } 286 } -
wishlist-everywhere/tags/1.0.6/public/js/wishlist-everywhere-plugin-public.js
r3326402 r3326426 31 31 ); 32 32 33 if (typeof wishlistPostIds !== 'undefined') { 34 wishlistPostIds.forEach(function(postId) { 35 $('ul.products .post-' + postId + ' i.fa-heart') 36 .removeClass('fa-regular') 37 .addClass('fa-solid'); 38 }); 39 } 40 33 41 // Add to Wishlist AJAX function 34 42 function addToWishlist(postId) … … 45 53 success: function (response) { 46 54 if (response.success) { 47 // jQuery('ul.products').find('i.fa-heart').removeClass('fa-regular');48 // jQuery('ul.products').find('i.fa-heart').addClass('fa-solid');49 55 Swal.fire( 50 56 { … … 58 64 { 59 65 if (result.isConfirmed) { 60 window.location.href = window.location.href + `?post-${postId}`; 61 // $('.wishlist-icon').removeClass('fa-regular'); 62 // $('.wishlist-icon').addClass('fa-solid'); 66 // window.location.href = window.location.href + `?post-${postId}`; 67 jQuery(`ul.products .post-${postId} i.fa-heart`) 68 .removeClass('fa-regular') 69 .addClass('fa-solid'); 63 70 } 64 71 } … … 119 126 ); 120 127 // window.location.href = window.location.href+'?sd'; 121 jQuery('.wishlist-icon').removeClass("wishlist-added");128 // jQuery('.wishlist-icon').removeClass("wishlist-added"); 122 129 // You can perform additional actions here after successful removal from the wishlist 123 130 } else { -
wishlist-everywhere/tags/1.0.6/wishlist-everywhere.php
r3326402 r3326426 20 20 * Plugin URI: https://github.com/abdullahnart/wishlist-everywhere 21 21 * Description: A simple yet flexible plugin that enables wishlist functionality for all post types — including products, blog posts, or custom post types. Easily customize labels and manage user wishlists across your WordPress site. 22 * Version: 1.0. 622 * Version: 1.0.7 23 23 * Author: Abdullah Naseem 24 24 * Author URI: https://github.com/abdullahnart/wishlist-everywhere/ -
wishlist-everywhere/trunk/README.txt
r3325822 r3326426 4 4 Requires at least: 5.0 5 5 Tested up to: 6.8 6 Stable tag: 1.0. 66 Stable tag: 1.0.7 7 7 License: GPLv2 or later 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html -
wishlist-everywhere/trunk/admin/partials/wishlist-everywhere-plugin-admin-display.php
r3325822 r3326426 115 115 ]; 116 116 117 $wishlist_icons = [ 118 'icon_only' => 'Icon Only', 119 'text_only' => 'Text Only', 120 'icon_text' => 'Text + Icon', 121 ]; 122 117 123 118 124 unset($wishlist_post_types['attachment']); … … 143 149 } 144 150 151 if (!empty($_POST['wishlist_custom_icon'])) { 152 $wishlist_custom_icon = sanitize_text_field(wp_unslash($_POST['wishlist_custom_icon'])); 153 update_option('wishlist_custom_icon', $wishlist_custom_icon, true); 154 } 155 145 156 if (isset($_POST['wishlist_archive']) && $_POST['wishlist_archive'] === 'archive') { 146 157 update_option('wishlist_for_archive', 'archive'); … … 193 204 $wishlist_position = get_option('wishlist_archive_position'); 194 205 $wishlist_single_position = get_option('wishlist_single_position'); 206 $wishlist_icon_option = get_option('wishlist_custom_icon'); 195 207 196 208 unset($wishlist_post_types[$wishlist_post_name]); … … 200 212 $archive_position_val = ''; 201 213 $single_position_val = ''; 214 $wishlist_custom_icon = ''; 202 215 203 216 // Start building dropdown only if post types are available … … 237 250 } 238 251 252 253 if (!empty($wishlist_icons)) { 254 foreach ($wishlist_icons as $value => $label) { 255 $wishlist_custom_icon .= sprintf( 256 '<option value="%s"%s>%s</option>', 257 esc_attr($value), 258 selected($wishlist_icon_option, $value, false), 259 esc_html($label) 260 ); 261 } 262 } 239 263 240 264 echo ' … … 422 446 <div class = "row_wrapper"> 423 447 <div class = "group-wrapper"> 424 <h2>Wishlist Button Text</h2> 448 <h2>Wishlist Button Settings</h2> 449 <div class="form-group"> 450 <label>Display Style</label> 451 <select id="wishlist_custom_icon" name="wishlist_custom_icon"> 452 ' . $wishlist_custom_icon . ' 453 </select> 454 </div> 425 455 <div class="form-group"> 426 456 <label>Wishlist Button Label</label> … … 434 464 <div class = "detail-wrapper"> 435 465 <ol> 466 <li> 467 <strong>Display Style</strong><br> 468 Choose how the wishlist button appears on products: icon only, text only, or both. 469 </li> 436 470 <li> 437 471 <strong>Wishlist Button Label</strong><br> -
wishlist-everywhere/trunk/includes/class-wishlist-everywhere-plugin.php
r3325822 r3326426 105 105 add_shortcode('wishlist_everywhere_single', array($this, 'add_wishlist_icon_to_product_single')); 106 106 } 107 107 108 $wishlist_position = get_option('wishlist_archive_position'); 108 109 if($wishlist_position == 'above_thumbnail') { … … 113 114 add_shortcode('wishlist_everywhere_archive', array($this, 'add_wishlist_icon_to_product_archive')); 114 115 } 116 115 117 add_filter('woocommerce_add_to_cart_redirect', array($this, 'custom_redirect_after_add_to_cart'), 10, 1); 116 118 add_shortcode('wishlist_everywhere', [$this, 'display_wishlist_page']); … … 124 126 } 125 127 add_action('wp_head',[$this,'add_wishlist_custom_css']); 128 add_action('wp_footer',[$this,'wishlist_everywhere_js_data']); 126 129 127 130 } … … 584 587 // Choose class for position 585 588 $position_class = $wishlist_position === 'above_thumbnail' ? 'above_thumbnail' : 'no_thumbnail'; 586 589 $wishlist_icon_option = get_option('wishlist_custom_icon'); 587 590 if ($required_login === 'required_login') { 588 591 // Only for logged-in users 589 592 if (is_user_logged_in()) { 590 $wishlist_icon = '<div class="shop_wishlist_wrap ' . esc_attr($position_class) . '"> 591 <a href="#" class="wishlist-icon archive" data-post-id="' . esc_attr(get_the_ID()) . '">' . esc_html($wishlist_title) . '</a> 592 </div>'; 593 echo wp_kses_post($wishlist_icon); 593 if($wishlist_icon_option === 'text_only'){ 594 $wishlist_icon = '<div class="shop_wishlist_wrap ' . esc_attr($position_class) . '"> 595 <a href="#" class="wishlist-icon archive" data-post-id="' . esc_attr(get_the_ID()) . '">' . esc_html($wishlist_title) . '</a> 596 </div>'; 597 echo wp_kses_post($wishlist_icon); 598 }else if($wishlist_icon_option === 'icon_only'){ 599 $wishlist_icon = '<div class="shop_wishlist_wrap ' . esc_attr($position_class) . '"> 600 <a href="#" class="wishlist-icon archive" data-post-id="' . esc_attr(get_the_ID()) . '"><i class="fa-regular fa-heart"></i></a> 601 </div>'; 602 echo wp_kses_post($wishlist_icon); 603 }else{ 604 $wishlist_icon = '<div class="shop_wishlist_wrap ' . esc_attr($position_class) . '"> 605 <a href="#" class="wishlist-icon archive" data-post-id="' . esc_attr(get_the_ID()) . '"> <i class="fa-regular fa-heart"></i>' . esc_html($wishlist_title) . '</a> 606 </div>'; 607 echo wp_kses_post($wishlist_icon); 608 } 609 610 594 611 } else { 595 612 // Get the current URL to redirect back after login … … 619 636 $added_class = ' added'; 620 637 } 621 622 $wishlist_icon = '<div class="shop_wishlist_wrap ' . esc_attr($position_class) . '"> 623 <a href="#" class="wishlist-icon archive' . esc_attr($added_class) . '" data-post-id="' . esc_attr(get_the_ID()) . '">' . esc_html($wishlist_title) . '</a> 624 </div>'; 625 626 echo wp_kses_post($wishlist_icon); 638 if($wishlist_icon_option === 'text_only'){ 639 $wishlist_icon = '<div class="shop_wishlist_wrap ' . esc_attr($position_class) . '"> 640 <a href="#" class="wishlist-icon archive' . esc_attr($added_class) . '" data-post-id="' . esc_attr(get_the_ID()) . '">' . esc_html($wishlist_title) . '</a> 641 </div>'; 642 echo wp_kses_post($wishlist_icon); 643 }else if($wishlist_icon_option === 'icon_only'){ 644 $wishlist_icon = '<div class="shop_wishlist_wrap ' . esc_attr($position_class) . '"> 645 <a href="#" class="wishlist-icon archive' . esc_attr($added_class) . '" data-post-id="' . esc_attr(get_the_ID()) . '"><i class="fa-regular fa-heart"></i></a> 646 </div>'; 647 echo wp_kses_post($wishlist_icon); 648 }else{ 649 $wishlist_icon = '<div class="shop_wishlist_wrap ' . esc_attr($position_class) . '"> 650 <a href="#" class="wishlist-icon archive' . esc_attr($added_class) . '" data-post-id="' . esc_attr(get_the_ID()) . '"> <i class="fa-regular fa-heart"></i> ' . esc_html($wishlist_title) . '</a> 651 </div>'; 652 echo wp_kses_post($wishlist_icon); 653 } 654 627 655 } 628 656 } … … 823 851 echo do_shortcode('[wishlist_everywhere post_type = "product"]'); 824 852 } 853 854 function wishlist_everywhere_js_data() { 855 if (is_user_logged_in()) { 856 global $wpdb; 857 $user_id = get_current_user_id(); 858 $table = $wpdb->prefix . 'cstmwishlist'; 859 860 $ids = $wpdb->get_col($wpdb->prepare("SELECT post_id FROM {$table} WHERE user_id = %d", $user_id)); 861 echo '<script>var wishlistPostIds = ' . json_encode($ids) . ';</script>'; 862 } else { 863 echo '<script>var wishlistPostIds = [];</script>'; 864 } 825 865 } 866 } -
wishlist-everywhere/trunk/public/css/wishlist-everywhere-plugin-public.css
r3325822 r3326426 266 266 margin-top: 0; 267 267 position: relative; 268 display: flex; 269 align-items: center; 270 gap: 7px; 268 271 } 269 272 .no_thumbnail .wishlist-icon.archive { … … 272 275 margin-top: 10px; 273 276 } 277 278 @media screen and (max-width:767px) { 279 .wishlist-tab-content { 280 overflow: scroll; 281 } 282 .wishlist-table th, .wishlist-table td { 283 width: max-content; 284 white-space: nowrap; 285 } 286 } -
wishlist-everywhere/trunk/public/js/wishlist-everywhere-plugin-public.js
r3325822 r3326426 31 31 ); 32 32 33 if (typeof wishlistPostIds !== 'undefined') { 34 wishlistPostIds.forEach(function(postId) { 35 $('ul.products .post-' + postId + ' i.fa-heart') 36 .removeClass('fa-regular') 37 .addClass('fa-solid'); 38 }); 39 } 40 33 41 // Add to Wishlist AJAX function 34 42 function addToWishlist(postId) … … 45 53 success: function (response) { 46 54 if (response.success) { 47 // jQuery('ul.products').find('i.fa-heart').removeClass('fa-regular');48 // jQuery('ul.products').find('i.fa-heart').addClass('fa-solid');49 55 Swal.fire( 50 56 { … … 58 64 { 59 65 if (result.isConfirmed) { 60 window.location.href = window.location.href + `?post-${postId}`; 61 // $('.wishlist-icon').removeClass('fa-regular'); 62 // $('.wishlist-icon').addClass('fa-solid'); 66 // window.location.href = window.location.href + `?post-${postId}`; 67 jQuery(`ul.products .post-${postId} i.fa-heart`) 68 .removeClass('fa-regular') 69 .addClass('fa-solid'); 63 70 } 64 71 } … … 119 126 ); 120 127 // window.location.href = window.location.href+'?sd'; 121 jQuery('.wishlist-icon').removeClass("wishlist-added");128 // jQuery('.wishlist-icon').removeClass("wishlist-added"); 122 129 // You can perform additional actions here after successful removal from the wishlist 123 130 } else { -
wishlist-everywhere/trunk/wishlist-everywhere.php
r3325822 r3326426 20 20 * Plugin URI: https://github.com/abdullahnart/wishlist-everywhere 21 21 * Description: A simple yet flexible plugin that enables wishlist functionality for all post types — including products, blog posts, or custom post types. Easily customize labels and manage user wishlists across your WordPress site. 22 * Version: 1.0. 622 * Version: 1.0.7 23 23 * Author: Abdullah Naseem 24 24 * Author URI: https://github.com/abdullahnart/wishlist-everywhere/
Note: See TracChangeset
for help on using the changeset viewer.