Changeset 3438775
- Timestamp:
- 01/13/2026 04:04:57 PM (3 months ago)
- Location:
- post-types-slider/trunk
- Files:
-
- 9 edited
-
README.txt (modified) (3 diffs)
-
admin/class-post-type-slider-admin.php (modified) (17 diffs)
-
admin/partials/post-type-slider-admin-metaboxes.php (modified) (2 diffs)
-
includes/class-post-type-slider-activator.php (modified) (1 diff)
-
includes/class-post-type-slider-deactivator.php (modified) (1 diff)
-
includes/class-post-type-slider.php (modified) (1 diff)
-
post-types-slider.php (modified) (2 diffs)
-
public/css/post-type-slider-public.css (modified) (9 diffs)
-
public/js/post-type-slider-public.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
post-types-slider/trunk/README.txt
r3433570 r3438775 5 5 Tested up to: 6.7 6 6 Requires PHP: 7.4 7 Stable tag: 1.0. 67 Stable tag: 1.0.7 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 51 51 You can create multiple sliders, each with its own configuration and shortcode. 52 52 53 54 == Gutenberg & Elementor Blocks == 55 56 **Gutenberg Block:** 57 - A dedicated "Post Types Slider" block is available in the Gutenberg editor. 58 - Simply add the block, select your slider from the dropdown, and it will render dynamically in your post or page. 59 60 **Elementor Widget:** 61 - A "Post Types Slider" widget is available in Elementor. 62 - Drag and drop the widget into your layout, choose your slider, and adjust the styling using Elementor’s design panel. 63 64 This makes it super easy to integrate sliders without dealing with shortcodes. 65 53 66 == Frequently Asked Questions == 54 67 … … 75 88 7. **Button Settings:** Adjust button styles, colors, and padding to match your site’s design. 76 89 90 91 ## Privacy Policy 92 Post Types Slider uses [Appsero](https://appsero.com) SDK to collect some telemetry data upon user's confirmation. This helps us to troubleshoot problems faster & make product improvements. 93 94 Appsero SDK **does not gather any data by default.** The SDK only starts gathering basic telemetry data **when a user allows it via the admin notice**. We collect the data to ensure a great user experience for all our users. 95 96 Integrating Appsero SDK **DOES NOT IMMEDIATELY** start gathering data, **without confirmation from users in any case.** 97 98 Learn more about how [Appsero collects and uses this data](https://appsero.com/privacy-policy/). 99 100 77 101 == Changelog == 102 103 = 1.0.7 = 104 * Auto display “Out of Stock” button text when inventory is depleted 105 * Improved variable product support in grid/slider 106 * Enhanced AJAX add-to-cart handling 107 * Variable product price range display 108 * Gutenberg and Elementor widget blocks added 109 * Placeholder image added 78 110 79 111 = 1.0.6 = -
post-types-slider/trunk/admin/class-post-type-slider-admin.php
r3433570 r3438775 57 57 $this->version = $version; 58 58 add_action('init', [$this, 'posttysl_register_postslide']); 59 // add_action('init', [$this, 'posttysl_register_block']); 60 // add_action('enqueue_block_editor_assets', [$this, 'posttysl_enqueue_block_editor_assets']); 59 61 add_action('add_meta_boxes', [$this, 'posttype_slider_metaboxes']); 60 62 add_action('save_post', [$this, 'postslider_save_meta']); … … 69 71 add_action('wp_ajax_post_slider_add_to_cart', [$this, 'post_slider_add_to_cart']); 70 72 add_action('wp_ajax_nopriv_post_slider_add_to_cart', [$this, 'post_slider_add_to_cart']); 73 add_action('wp_ajax_posttysl_preview_slider', [$this, 'posttysl_preview_slider']); 74 add_action('wp_ajax_get_variation_id', [$this, 'posttysl_variation_id']); 75 add_action('wp_ajax_nopriv_get_variation_id', [$this, 'posttysl_variation_id']); 71 76 72 77 } … … 118 123 wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__) . 'js/post-type-slider-admin.js', array('jquery'), $this->version, false); 119 124 wp_localize_script($this->plugin_name, 'post_slider_handler', ['ajax_url' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('category_nonce')]); 125 126 } 127 128 129 130 /** 131 * Register the Gutenberg block for Post Type Slider. 132 * 133 * Uses block.json so assets are handled by WordPress. 134 * 135 * @return void 136 */ 137 public function posttysl_register_block() 138 { 139 } 140 141 142 /** 143 * Render block for post type slider 144 * @return string 145 * 146 */ 147 public function posttysl_render_block($attributes) 148 { 149 $slider_id = isset($attributes['sliderId']) ? absint($attributes['sliderId']) : 0; 150 // Fallback to the first available slider if none provided. 151 if (!$slider_id) { 152 $maybe_slider = get_posts( 153 array( 154 'post_type' => 'posttysl_slide', 155 'posts_per_page' => 1, 156 'post_status' => 'publish', 157 'fields' => 'ids', 158 ) 159 ); 160 if (!empty($maybe_slider)) { 161 $slider_id = (int) $maybe_slider[0]; 162 } 163 } 164 165 if (!$slider_id) { 166 return ''; // Nothing to render. 167 } 168 169 ob_start(); 170 echo '<div class="posttysl-block-wrapper">'; 171 echo do_shortcode('[posttysl_slider id="' . $slider_id . '"]'); 172 echo '</div>'; 173 return ob_get_clean(); 120 174 } 121 175 … … 172 226 173 227 228 if (!function_exists('register_block_type')) { 229 return; 230 } 231 232 233 register_block_type( 234 plugin_dir_path(__FILE__) . 'blocks/post-type-slider', 235 236 [ 237 'render_callback' => [$this, 'posttysl_render_block'], 238 ] 239 ); 174 240 } 175 241 … … 220 286 221 287 include plugin_dir_path(__FILE__) . 'partials/post-type-slider-admin-metabox-shortcode.php'; 222 223 288 } 224 289 } … … 404 469 wp_send_json_success(['success' => true, 'message' => 'Product added to cart']); 405 470 } else { 406 wp_send_json_error(['success' => false, 'message' => 'Failed to add product to cart' ]);471 wp_send_json_error(['success' => false, 'message' => 'Failed to add product to cart', 'error' => wc_get_notices()]); 407 472 } 408 473 } … … 503 568 $data['grid_gap'] = sanitize_text_field($_POST['grid_gap']); 504 569 570 if (isset($_POST['slider_postype']) && $_POST['slider_postype'] == 'product') { 571 $data['button_text'] = 'Add to Cart'; 572 } 505 573 // $data['theme_primary'] = sanitize_hex_color($_POST['theme_primary']); 506 574 // $data['theme_secondary'] = sanitize_hex_color($_POST['theme_secondary']); … … 677 745 678 746 747 public function posttysl_preview_slider() 748 { 749 if (!current_user_can('edit_posts')) { 750 wp_send_json_error('Unauthorized'); 751 } 752 753 $slider_id = isset($_POST['sliderId']) ? intval($_POST['sliderId']) : 0; 754 755 if (!$slider_id) { 756 wp_send_json_error('Invalid slider'); 757 } 758 759 // 🔥 SAME render function jo frontend pe use hota hai 760 ob_start(); 761 762 // Example render (replace with your actual logic) 763 echo do_shortcode('[posttysl_slider id="' . $slider_id . '"]'); 764 765 $html = ob_get_clean(); 766 767 wp_send_json_success($html); 768 } 769 770 public function posttysl_variation_id() 771 { 772 773 if (empty($_POST['product_id']) || empty($_POST['attributes'])) { 774 wp_send_json_error('Missing data'); 775 } 776 777 $product_id = absint($_POST['product_id']); 778 $attributes = $_POST['attributes']; 779 780 $product = wc_get_product($product_id); 781 782 if (!$product || !$product->is_type('variable')) { 783 wp_send_json_error('Invalid product'); 784 } 785 786 foreach ($product->get_available_variations() as $variation) { 787 788 $match = true; 789 790 foreach ($variation['attributes'] as $attr_name => $attr_value) { 791 792 if ( 793 !isset($attributes[$attr_name]) || 794 $attributes[$attr_name] !== $attr_value 795 ) { 796 $match = false; 797 break; 798 } 799 } 800 801 if ($match) { 802 wp_send_json_success([ 803 'variation_id' => $variation['variation_id'], 804 'price_html' => $variation['price_html'], 805 'is_in_stock' => $variation['is_in_stock'], 806 ]); 807 } 808 } 809 810 wp_send_json_error('No matching variation found'); 811 } 812 679 813 /** 680 814 * Ajax call for post category … … 773 907 774 908 $button_text = $slider_settings['button_text'] ? $slider_settings['button_text'] : 'Read More'; 909 if ($post_type == 'product') { 910 911 $button_text = 'Add to Cart'; 912 } 775 913 $post_column = $slider_settings['cards_per_row']; 776 914 $s_dots = $slider_settings['dots']; … … 815 953 foreach ($posts as $post) { 816 954 955 $button_text = $slider_settings['button_text'] ?? 'Read More'; 956 if ($post_type == 'product') { 957 958 $button_text = 'Add to Cart'; 959 } 960 $p_id = $post->ID; 817 961 $date = get_the_date('d-M-Y'); 818 962 $terms = wp_get_post_terms($post->ID, $slider_post_category, ['fields' => 'names']) ? wp_get_post_terms($post->ID, $slider_post_category, ['fields' => 'names']) : ''; … … 829 973 $html .= "<div class='post_slide' style='" . $grid_style . "border:" . $slider_settings['border_width'] . "px solid " . $slider_settings['border_color'] . "; border-radius:" . $slider_settings['border_radius'] . "px; '>"; 830 974 831 if ($slider_settings['show_image'] == '1') { 832 833 $html .= "<div class='thumbnail'>" . get_the_post_thumbnail($post->ID, 'full') . "</div>"; 975 if ($slider_settings['show_image'] == '1' && get_the_post_thumbnail($post->ID, 'full')) { 976 977 $html .= "<div class='thumbnail'><a href='" . get_the_permalink($post->ID) . "'>" . get_the_post_thumbnail($post->ID, 'full') . "</a></div>"; 978 }else{ 979 980 $html .= "<div class='thumbnail'><a href='" . get_the_permalink($post->ID) . "'><img src='" . plugin_dir_url(__FILE__) . "images/placeholder-image.png' alt='No Image'></a></div>"; 834 981 } 835 982 $html .= " … … 840 987 841 988 $html .= "<div class='post_meta'>"; 842 $slider_settings['show_date'] == '1' ? $html .= "<p class='meta_date'>Date: " . $date . "</p>" : ''; 989 990 $slider_settings['show_date'] == '1' ? $html .= "<p class='meta_date'>" . date('M-d-Y', strtotime($date)) . "</p>" : ''; 843 991 $slider_settings['show_category'] == '1' && $terms ? $html .= "<p class='meta_category'>" . $post_terms . "</p>" : ''; 844 992 $html .= "</div>"; … … 847 995 $price = get_post_meta($post->ID, '_price', true); 848 996 $currency = get_woocommerce_currency_symbol(); 849 $html .= "<p class='product_price'>Price: {$currency}{$price} </p>"; 997 $class2 = ''; 998 $product = wc_get_product($post->ID); 999 1000 if ($product) { 1001 $class2 = $product->is_in_stock() ? 'p_enabled' : 'p_disabled'; 1002 1003 if (!$product->is_in_stock()) { 1004 $button_text = 'Out of Stock'; 1005 } 1006 } else { 1007 continue; // skip invalid product 1008 } 1009 1010 if ( $product->is_type( 'variable' ) ) { 1011 $variation_prices = $product->get_variation_prices( true ); 1012 1013 // Get min and max prices 1014 $min_price = current( $variation_prices['price'] ); // first price 1015 $max_price = end( $variation_prices['price'] ); // last price 1016 1017 // Format prices with currency symbol 1018 $price_html = $currency . $min_price; 1019 if ( $min_price != $max_price ) { 1020 $price_html .= ' - ' . $currency . $max_price; 1021 } 1022 1023 $html .= "<p class='product_price'>Price: <span class='price_value'>{$price_html}</span></p>"; 1024 1025 } else { 1026 $html .= "<p class='product_price'>Price: <span class='price_value'>{$currency}{$price}</span></p>"; 1027 } 1028 // wp_enqueue_script('wc-add-to-cart-variation'); 1029 1030 // ob_start(); 1031 1032 ?> 1033 <!-- <form class="variations_form cart" data-product_id="<?php 1034 // echo absint($product->get_id()); ?>" 1035 data-product_variations='<?php 1036 // echo wp_json_encode($product->get_available_variations()); ?>'> 1037 1038 <?php 1039 // foreach ($product->get_variation_attributes() as $attribute_name => $options): ?> 1040 <div class="variation-field"> 1041 <label><?php 1042 // echo wc_attribute_label($attribute_name); ?></label> 1043 <?php 1044 // wc_dropdown_variation_attribute_options([ 1045 // 'options' => $options, 1046 // 'attribute' => $attribute_name, 1047 // 'product' => $product, 1048 // ]); 1049 ?> 1050 </div> 1051 <?php 1052 // endforeach; ?> 1053 1054 </form> --> 1055 <?php 1056 1057 // $html .= ob_get_clean(); 1058 // } 1059 850 1060 } 1061 1062 851 1063 if ($slider_settings['show_description'] == '1') { 852 1064 $html .= " <p style='font-size:" . $slider_settings['font_desc'] . "px; color:" . $slider_settings['desc_color'] . "'>" . mb_strimwidth(get_the_excerpt($post->ID), 0, 100, '....') . "</p>"; … … 854 1066 855 1067 if ($slider_settings['show_button'] == '1') { 856 $html .= "<div class='readmore'><a class='" . $class . "' data-id='" . $post->ID . "' href='" . get_the_permalink($post->ID) . "' 857 style='color: " . $slider_settings['button_text_color'] . "; background-color:" . $slider_settings['button_color'] . "; padding:" . $slider_settings['button_padding'] . "; border-radius:" . ($slider_settings['button_style'] == 'rounded' ? '25px' : '4px') . ";'> 858 " . $button_text . "</a></div>"; 1068 1069 $html .= "<div class='readmore'>"; 1070 1071 if ($post_type === 'product' && $product && $product->is_type('variable')) { 1072 1073 // Variable product button (JS handles add to cart) 1074 $html .= " 1075 <a class='{$class2}' 1076 data-product-id= '{$p_id}' href='" . $product->get_permalink() . "' 1077 data-id='' 1078 style='color: {$slider_settings['button_text_color']}; 1079 background-color: {$slider_settings['button_color']}; 1080 padding: {$slider_settings['button_padding']}; 1081 border-radius: " . ($slider_settings['button_style'] == 'rounded' ? '25px' : '4px') . ";'> 1082 Select Options 1083 </a>"; 1084 1085 } else { 1086 1087 // Simple product / post 1088 $html .= " 1089 <a class='{$class} {$class2}' 1090 data-id='{$p_id}' 1091 href='" . get_the_permalink($post->ID) . "' 1092 style='color: {$slider_settings['button_text_color']}; 1093 background-color: {$slider_settings['button_color']}; 1094 padding: {$slider_settings['button_padding']}; 1095 border-radius: " . ($slider_settings['button_style'] == 'rounded' ? '25px' : '4px') . ";'> 1096 {$button_text} 1097 </a>"; 1098 } 1099 1100 $html .= "</div>"; 859 1101 } 1102 860 1103 861 1104 $html .= "</div> 862 1105 </div>"; 863 864 1106 } 865 1107 $html .= "</div>"; … … 887 1129 </style> 888 1130 <script> 889 890 1131 jQuery(document).ready(function ($) { 891 1132 jQuery('.post_type_slider').slick({ 892 infinite: true, // Infinite loop1133 infinite: true, // Infinite loop 893 1134 slidesToShow: <?php echo (int) $post_column; ?>, // Server-side column count 894 1135 slidesToScroll: 1, 895 1136 autoplay: false, 896 1137 autoplaySpeed: 2000, 897 dots: <?php echo $s_dots ? 'true' : 'false'; ?>, // Ensure boolean1138 dots: <?php echo $s_dots ? 'true' : 'false'; ?>, // Ensure boolean 898 1139 arrows: <?php echo $s_arrows ? 'true' : 'false'; ?>, // Ensure boolean 899 1140 nextArrow: '<button type="button" class="slick-next"><i class="fa fa-chevron-right"></i></button>', 900 1141 prevArrow: '<button type="button" class="slick-prev"><i class="fa fa-chevron-left"></i></button>', 901 centerMode: false, 902 responsive: [ 903 { 904 breakpoint: 1200, // Large tablet / small desktop 905 settings: { 906 slidesToShow: Math.min(<?php echo (int) $post_column; ?>, 3), 907 slidesToScroll: 1 908 } 909 }, 910 { 911 breakpoint: 1024, // Tablet 912 settings: { 913 slidesToShow: 2, 914 slidesToScroll: 1 915 } 916 }, 917 { 918 breakpoint: 768, // Mobile 919 settings: { 920 slidesToShow: 1, 921 slidesToScroll: 1, 922 dots: <?php echo $s_dots ? 'true' : 'false'; ?>, // Ensure boolean 923 arrows: <?php echo $s_arrows ? 'true' : 'false'; ?>, // Ensure boolean 924 } 1142 centerMode: true, 1143 centerPadding: '0px', 1144 responsive: [{ 1145 breakpoint: 1200, // Large tablet / small desktop 1146 settings: { 1147 slidesToShow: Math.min(<?php echo (int) $post_column; ?>, 3), 1148 slidesToScroll: 1 925 1149 } 1150 }, 1151 { 1152 breakpoint: 1024, // Tablet 1153 settings: { 1154 slidesToShow: 2, 1155 slidesToScroll: 1 1156 } 1157 }, 1158 { 1159 breakpoint: 768, // Mobile 1160 settings: { 1161 slidesToShow: 1, 1162 slidesToScroll: 1, 1163 dots: <?php echo $s_dots ? 'true' : 'false'; ?>, // Ensure boolean 1164 arrows: <?php echo $s_arrows ? 'true' : 'false'; ?>, // Ensure boolean 1165 } 1166 } 926 1167 ] 927 1168 }); 928 1169 }); 929 930 1170 </script> 931 1171 … … 933 1173 934 1174 return $html . ob_get_clean(); 935 936 1175 } 937 1176 … … 988 1227 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> 989 1228 <script> 990 991 1229 jQuery(document).ready(function () { 992 1230 993 1231 jQuery('.post_type_slider').slick({ 994 infinite: true, // Enable infinite looping995 slidesToShow: <?php echo $category_column; ?>, // Display 3 slides at once1232 infinite: true, // Enable infinite looping 1233 slidesToShow: <?php echo $category_column; ?>, // Display 3 slides at once 996 1234 slidesToScroll: 1, // Scroll 1 slide at a time 997 autoplay: false, // Enable autoplay1235 autoplay: false, // Enable autoplay 998 1236 autoplaySpeed: 2000, // 2 seconds autoplay speed 999 1237 dots: true, 1000 1238 arrows: false, 1001 1239 centerMode: false, 1002 responsive: [ 1003 { 1004 breakpoint: 1024, // Adjust for tablet size 1005 settings: { 1006 slidesToShow: 2, // Show 2 slides on medium screens 1007 slidesToScroll: 1 1008 } 1009 }, 1010 { 1011 breakpoint: 768, // Adjust for mobile size 1012 settings: { 1013 slidesToShow: 1, // Show 1 slide on small screens 1014 slidesToScroll: 1 1015 } 1240 responsive: [{ 1241 breakpoint: 1024, // Adjust for tablet size 1242 settings: { 1243 slidesToShow: 2, // Show 2 slides on medium screens 1244 slidesToScroll: 1 1016 1245 } 1246 }, 1247 { 1248 breakpoint: 768, // Adjust for mobile size 1249 settings: { 1250 slidesToShow: 1, // Show 1 slide on small screens 1251 slidesToScroll: 1 1252 } 1253 } 1017 1254 ] 1018 1255 }); -
post-types-slider/trunk/admin/partials/post-type-slider-admin-metaboxes.php
r3433570 r3438775 12 12 <button class="tab-btn <?php echo isset($_GET['tab']) && $_GET['tab'] == 'customize' ? 'active' : '' ?>" 13 13 data-tab="customize">Customize</button> 14 <button style="display:<?php echo $slider_type == 'grid' ? 'block' : ' none'; ?>"class="tab-btn <?php echo isset($_GET['tab']) && $_GET['tab'] == 'template' ? 'active' : '' ?>"14 <button style="display:<?php echo $slider_type == 'grid' ? 'block' : 'block'; ?>" class="tab-btn <?php echo isset($_GET['tab']) && $_GET['tab'] == 'template' ? 'active' : '' ?>" 15 15 data-tab="template">Template</button> 16 16 <?php do_action('pt_slider_admin_more_tabs', $post); ?> … … 165 165 <tr> 166 166 <th>Show Category</th> 167 <td><label><input type="checkbox" name="show_category" <?php echo (!isset($opts['show_category']) ||$opts['show_category'] == '1') ? 'checked="checked"' : ''; ?> /> Enable</label></td>167 <td><label><input type="checkbox" name="show_category" <?php echo (!isset($opts['show_category']) && $opts['show_category'] == '1') ? 'checked="checked"' : ''; ?> /> Enable</label></td> 168 168 </tr> 169 169 <tr> 170 170 <th>Show Date</th> 171 <td><label><input type="checkbox" name="show_date" <?php echo (!isset($opts['show_date']) ||$opts['show_date'] == '1') ? 'checked="checked"' : ''; ?> /> Enable</label></td>171 <td><label><input type="checkbox" name="show_date" <?php echo (!isset($opts['show_date']) && $opts['show_date'] == '1') ? 'checked="checked"' : ''; ?> /> Enable</label></td> 172 172 </tr> 173 173 <tr> -
post-types-slider/trunk/includes/class-post-type-slider-activator.php
r3367949 r3438775 32 32 */ 33 33 public static function activate() 34 { 35 $setting= get_option('posttysl_settings', true); 34 { 36 35 37 if(!$setting){38 $data= array(39 'show_title' => '1',40 'show_description' => '1',41 'show_image' => '1',42 'arrows' => '1',43 'dots' => '1',44 'font_title' => 20,45 'font_desc' => 14,46 'box_shadow' => '0 4px 10px rgba(19,39,68,0.15)',47 'border_width' => 1,48 'border_radius' => 8,49 'button_style' => 'rounded',50 'title_color' => '#000000ff',51 'desc_color' => '#000000ff',52 'border_color' => '#ffffffff',53 'dots_color' => '#000000',54 'arrow_color' => '#000000',55 'button_text_color' => '#f5f5f5ff',56 'button_color' => '#0b67ff',57 'button_padding' => '10px 18px',58 'theme_primary' => '#0b67ff',59 'theme_secondary' => '#0f9d58',60 'theme_accent' => '#ffb300',61 'bg_color' => '#ffffff',62 'text_color' => '#222222',63 'branding_logo' => '',64 'cards_per_row'=> '3'65 );66 36 67 update_option('posttysl_settings', $data); 37 do_action('appsero_tracker_activated'); 38 $setting = get_option('posttysl_settings', true); 39 40 if (!$setting) { 41 $data = array( 42 'show_title' => '1', 43 'show_description' => '1', 44 'show_image' => '1', 45 'show_date' => '0', 46 'arrows' => '1', 47 'dots' => '1', 48 'font_title' => 20, 49 'font_desc' => 14, 50 'box_shadow' => '0 4px 10px rgba(19,39,68,0.15)', 51 'border_width' => 1, 52 'border_radius' => 8, 53 'button_style' => 'rounded', 54 'title_color' => '#000000ff', 55 'desc_color' => '#000000ff', 56 'border_color' => '#ffffffff', 57 'dots_color' => '#000000', 58 'arrow_color' => '#000000', 59 'button_text_color' => '#f5f5f5ff', 60 'button_color' => '#000000ff', 61 'button_padding' => '10px 18px', 62 'theme_primary' => '#0b67ff', 63 'theme_secondary' => '#0f9d58', 64 'theme_accent' => '#ffb300', 65 'bg_color' => '#ffffff', 66 'text_color' => '#222222', 67 'branding_logo' => '', 68 'cards_per_row' => '3' 69 ); 70 71 update_option('posttysl_settings', $data); 68 72 } 69 73 } -
post-types-slider/trunk/includes/class-post-type-slider-deactivator.php
r3284786 r3438775 31 31 */ 32 32 public static function deactivate() { 33 33 34 do_action( 'appsero_tracker_deactivated' ); 34 35 unregister_post_type('slide'); 36 delete_option('posttysl_settings'); 35 37 } 36 38 -
post-types-slider/trunk/includes/class-post-type-slider.php
r3284786 r3438775 117 117 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-post-type-slider-admin.php'; 118 118 119 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/widget/elementor/elementor-post-type-slider-widget.php'; 119 120 /** 120 121 * The class responsible for defining all actions that occur in the public-facing -
post-types-slider/trunk/post-types-slider.php
r3433570 r3438775 17 17 * Plugin URI: https://clickysoft.com 18 18 * Description: Post Type Slider can easily create responsive sliders from any post type, including posts, pages, or custom post types. It’s perfect for showcasing blog posts, products, portfolios, or featured content with smooth navigation and customizable display options. 19 * Version: 1.0. 619 * Version: 1.0.7 20 20 * Author: Clickysoft 21 21 * Author URI: https://clickysoft.com/ … … 66 66 */ 67 67 require plugin_dir_path(__FILE__) . 'includes/class-post-type-slider.php'; 68 require __DIR__ . '/vendor/autoload.php'; 69 70 71 72 /** 73 * Initialize the plugin tracker 74 * 75 * @return void 76 */ 77 function appsero_init_tracker_post_types_slider() { 78 79 // if ( ! class_exists( 'Appsero\Client' ) ) { 80 // require_once __DIR__ . '/appsero/src/Client.php'; 81 // } 82 83 $client = new Appsero\Client( '8301dcd3-87d5-4750-a04d-c08641937c40', 'Post Types Slider', __FILE__ ); 84 85 // Active insights 86 $client->insights()->init(); 87 // Active automatic updater 88 $client->updater(); 89 90 // Active license page and checker 91 // $args = array( 92 // 'type' => 'options', 93 // 'menu_title' => 'Post Types Slider', 94 // 'page_title' => 'Post Types Slider', 95 // 'menu_slug' => 'posttype_slider', 96 // ); 97 // $client->license()->add_settings_page( $args ); 98 99 } 100 101 appsero_init_tracker_post_types_slider(); 102 103 68 104 69 105 /** -
post-types-slider/trunk/public/css/post-type-slider-public.css
r3433570 r3438775 8 8 .thumbnail img { 9 9 width: 100% !important; 10 height: 300px !important;10 /* height: 300px !important; */ 11 11 object-fit: cover; 12 12 } … … 28 28 } 29 29 30 .post_meta p {31 32 color: black;33 font-weight: 600;34 margin: 0px;35 padding: 5px 0;36 border-radius: 10px;30 .post_meta p { 31 32 color: black; 33 font-weight: 600; 34 margin: 0px; 35 padding: 5px 0; 36 border-radius: 10px; 37 37 } 38 38 … … 40 40 border: none !important; 41 41 } 42 43 a.ajax_add_to_cart.p_disabled { 44 pointer-events: none; 45 background-color: #9e9e9e !important; 46 /* color: black !important; */ 47 } 48 42 49 43 50 .post_slide h2 { … … 53 60 .post_type_grid { 54 61 display: grid !important; 55 gap: 20px; /* space between cards */ 62 gap: 20px; 63 /* space between cards */ 56 64 } 57 65 … … 89 97 } 90 98 99 /* Slider layout css */ 100 101 102 /* .slider_layout8 .slick-slide { 103 transform: scale(0.7); 104 } 105 106 .slider_layout8 .slick-center { 107 transform: scale(1.3); 108 } */ 109 110 111 112 a.ajax_add_to_cart.p_enabled.variable_btn.disabled { 113 background: #8080806e !important; 114 } 91 115 92 116 ul.slick-dots { … … 128 152 129 153 .ajax_add_to_cart { 130 align-items:center; 131 gap:5px; 132 display:flex; 133 } 134 154 align-items: center; 155 gap: 5px; 156 display: flex; 157 } 158 159 160 .variation-field { 161 display: flex; 162 align-items: center; 163 gap: 10px; 164 margin: 0 0px 15px 0; 165 } 166 167 .variation-field label { 168 font-size: 16px; 169 color: black; 170 width: 15%; 171 font-weight: bold; 172 } 135 173 136 174 137 175 p.product_price { 138 font-size:18px; 139 color:black; 140 font-weight:600; 141 } 176 /* margin-top: 15px; */ 177 font-size: 18px; 178 color: black; 179 font-weight: 600; 180 } 181 142 182 .post_type_grid .post_slide { 143 183 /* width: 32%; */ … … 149 189 .post_type_slider button.slick-prev.slick-arrow { 150 190 151 position: absolute;152 left: -2%;153 top: 50%;154 } 155 156 .post_type_slider button.slick-next.slick-arrow {191 position: absolute; 192 left: -2%; 193 top: 50%; 194 } 195 196 .post_type_slider button.slick-next.slick-arrow { 157 197 cursor: pointer; 158 position:absolute; 159 top:50%; 160 right:-2%; 161 } 162 163 .post_type_slider .slick-arrow:hover,.readmore a:hover{ 164 165 background:#0b67ff !important; 166 color:white !important; 167 } 168 169 .readmore a{ 170 display:flex; 171 width:fit-content; 198 position: absolute; 199 top: 50%; 200 right: -2%; 201 } 202 203 .post_type_slider .slick-arrow:hover, 204 .readmore a:hover { 205 206 cursor: pointer; 207 background: #0b67ff !important; 208 color: white !important; 209 } 210 211 .readmore a { 212 display: flex; 213 width: fit-content; 172 214 text-decoration: none !important; 173 215 } 174 216 175 217 .readmore { 176 margin-bottom: 10px;177 } 178 179 .post_type_slider .slick-arrow {180 width: 40px;218 margin-bottom: 10px; 219 } 220 221 .post_type_slider .slick-arrow { 222 width: 40px; 181 223 z-index: 9999; 182 224 /* background: black; */ … … 197 239 .post_type_grid .post_slide { 198 240 199 width: 100% ;241 width: 100% !important; 200 242 } 201 243 202 244 .post_type_grid { 203 flex-direction: column; 204 gap: 10px; 245 flex-direction: column !important; 246 gap: 10px !important; 247 grid-template-columns: 1fr !important; 205 248 } 206 249 … … 229 272 } 230 273 231 @media (min-width: 320px) and (max-width: 529px) {274 @media (min-width: 320px) and (max-width: 529px) { 232 275 233 276 .post_type_slider button.slick-next.slick-arrow { 234 right: 0%; 235 } 277 right: 0%; 278 } 279 236 280 .post_type_slider button.slick-prev.slick-arrow { 237 281 left: 0%; 238 282 } 239 283 } 284 285 /* Ipad */ 286 287 @media (min-width: 768px) and (max-width: 1023px) { 288 289 .readmore a { 290 font-size: 14px; 291 padding: 2px 10px !important; 292 } 293 } -
post-types-slider/trunk/public/js/post-type-slider-public.js
r3433570 r3438775 65 65 // }); 66 66 67 jQuery(document).on("click", ". readmore.ajax_add_to_cart", function (e) {67 jQuery(document).on("click", ".post_content .ajax_add_to_cart", function (e) { 68 68 e.preventDefault(); 69 69 var $this = jQuery(this); … … 83 83 }, 84 84 beforeSend: function () { 85 85 86 86 $this.html('Adding <img src="' + loder + '" alt="Loading..." style="width:20px;height:20px;"/>'); 87 87 // $this.text("Adding..."); … … 92 92 93 93 $this.text("Added"); 94 setTimeout(() => {95 $this.text("Add to Cart");96 }, 2000);94 // setTimeout(() => { 95 // $this.text("Add to Cart"); 96 // }, 2000); 97 97 } 98 98 }, … … 105 105 }) 106 106 107 108 jQuery(document).on('change', '.variations_form select', function () { 109 110 let form = jQuery(this).closest('.variations_form'); 111 let product_id = form.data('product_id'); 112 let attributes = {}; 113 114 form.find('select').each(function () { 115 let name = jQuery(this).attr('name'); 116 let val = jQuery(this).val(); 117 118 if (val) { 119 attributes[name] = val; 120 } 121 }); 122 123 // All attributes must be selected 124 if (Object.keys(attributes).length !== form.find('select').length) { 125 return; 126 } 127 128 jQuery.ajax({ 129 url: post_handler.ajax_url, 130 type: 'POST', 131 beforeSend: function () { 132 let btn = form.closest('.post_content').find('.variable_btn'); 133 btn.text("Loading..."); 134 btn.addClass('disabled'); 135 }, 136 data: { 137 action: 'get_variation_id', 138 product_id: product_id, 139 attributes: attributes 140 }, 141 success: function (res) { 142 143 let btn = form.closest('.post_content').find('.variable_btn'); 144 if (res.success) { 145 146 // console.log(res.data); 147 let price = form.closest('.post_content').find('.price_value'); 148 price.html(res.data.price_html); 149 btn.attr('data-id', res.data.variation_id); 150 btn.text("Add to Cart"); 151 btn.removeClass('disabled'); 152 153 // // Optional: update price 154 // form.closest('.post_slide') 155 // .find('.product_price') 156 // .html(res.data.price_html); 157 158 } else { 159 console.warn(res.data); 160 btn.text("Add to Cart"); 161 } 162 } 163 }); 164 }); 165 166 107 167 }) 108 168
Note: See TracChangeset
for help on using the changeset viewer.