Plugin Directory

Changeset 3438775


Ignore:
Timestamp:
01/13/2026 04:04:57 PM (3 months ago)
Author:
userlog45
Message:

version release 1.0.7

Location:
post-types-slider/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • post-types-slider/trunk/README.txt

    r3433570 r3438775  
    55Tested up to: 6.7
    66Requires PHP: 7.4
    7 Stable tag:  1.0.6
     7Stable tag:  1.0.7
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    5151You can create multiple sliders, each with its own configuration and shortcode.
    5252
     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
     64This makes it super easy to integrate sliders without dealing with shortcodes.
     65
    5366== Frequently Asked Questions ==
    5467
     
    75887. **Button Settings:** Adjust button styles, colors, and padding to match your site’s design.
    7689
     90
     91## Privacy Policy
     92Post 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
     94Appsero 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
     96Integrating Appsero SDK **DOES NOT IMMEDIATELY** start gathering data, **without confirmation from users in any case.**
     97
     98Learn more about how [Appsero collects and uses this data](https://appsero.com/privacy-policy/).
     99
     100
    77101== 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
    78110
    79111= 1.0.6 =
  • post-types-slider/trunk/admin/class-post-type-slider-admin.php

    r3433570 r3438775  
    5757        $this->version = $version;
    5858        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']);
    5961        add_action('add_meta_boxes', [$this, 'posttype_slider_metaboxes']);
    6062        add_action('save_post', [$this, 'postslider_save_meta']);
     
    6971        add_action('wp_ajax_post_slider_add_to_cart', [$this, 'post_slider_add_to_cart']);
    7072        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']);
    7176
    7277    }
     
    118123        wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__) . 'js/post-type-slider-admin.js', array('jquery'), $this->version, false);
    119124        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();
    120174    }
    121175
     
    172226
    173227
     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        );
    174240    }
    175241
     
    220286
    221287            include plugin_dir_path(__FILE__) . 'partials/post-type-slider-admin-metabox-shortcode.php';
    222 
    223288        }
    224289    }
     
    404469            wp_send_json_success(['success' => true, 'message' => 'Product added to cart']);
    405470        } 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()]);
    407472        }
    408473    }
     
    503568            $data['grid_gap'] = sanitize_text_field($_POST['grid_gap']);
    504569
     570            if (isset($_POST['slider_postype']) && $_POST['slider_postype'] == 'product') {
     571                $data['button_text'] = 'Add to Cart';
     572            }
    505573            // $data['theme_primary'] = sanitize_hex_color($_POST['theme_primary']);
    506574            // $data['theme_secondary'] = sanitize_hex_color($_POST['theme_secondary']);
     
    677745
    678746
     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
    679813    /**
    680814     * Ajax call for post category
     
    773907
    774908        $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        }
    775913        $post_column = $slider_settings['cards_per_row'];
    776914        $s_dots = $slider_settings['dots'];
     
    815953            foreach ($posts as $post) {
    816954
     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;
    817961                $date = get_the_date('d-M-Y');
    818962                $terms = wp_get_post_terms($post->ID, $slider_post_category, ['fields' => 'names']) ? wp_get_post_terms($post->ID, $slider_post_category, ['fields' => 'names']) : '';
     
    829973                $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; '>";
    830974
    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>";
    834981                }
    835982                $html .= "
     
    840987
    841988                $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>" : '';
    843991                $slider_settings['show_category'] == '1' && $terms ? $html .= "<p class='meta_category'>" . $post_terms . "</p>" : '';
    844992                $html .= "</div>";
     
    847995                    $price = get_post_meta($post->ID, '_price', true);
    848996                    $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
    8501060                }
     1061
     1062
    8511063                if ($slider_settings['show_description'] == '1') {
    8521064                    $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>";
     
    8541066
    8551067                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>";
    8591101                }
     1102
    8601103
    8611104                $html .= "</div>
    8621105                        </div>";
    863 
    8641106            }
    8651107            $html .= "</div>";
     
    8871129        </style>
    8881130        <script>
    889 
    8901131            jQuery(document).ready(function ($) {
    8911132                jQuery('.post_type_slider').slick({
    892                     infinite: true,                     // Infinite loop
     1133                    infinite: true, // Infinite loop
    8931134                    slidesToShow: <?php echo (int) $post_column; ?>, // Server-side column count
    8941135                    slidesToScroll: 1,
    8951136                    autoplay: false,
    8961137                    autoplaySpeed: 2000,
    897                     dots: <?php echo $s_dots ? 'true' : 'false'; ?>,     // Ensure boolean
     1138                    dots: <?php echo $s_dots ? 'true' : 'false'; ?>, // Ensure boolean
    8981139                    arrows: <?php echo $s_arrows ? 'true' : 'false'; ?>, // Ensure boolean
    8991140                    nextArrow: '<button type="button" class="slick-next"><i class="fa fa-chevron-right"></i></button>',
    9001141                    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
    9251149                        }
     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                    }
    9261167                    ]
    9271168                });
    9281169            });
    929 
    9301170        </script>
    9311171
     
    9331173
    9341174        return $html . ob_get_clean();
    935 
    9361175    }
    9371176
     
    9881227        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    9891228        <script>
    990 
    9911229            jQuery(document).ready(function () {
    9921230
    9931231                jQuery('.post_type_slider').slick({
    994                     infinite: true,   // Enable infinite looping
    995                     slidesToShow: <?php echo $category_column; ?>,  // Display 3 slides at once
     1232                    infinite: true, // Enable infinite looping
     1233                    slidesToShow: <?php echo $category_column; ?>, // Display 3 slides at once
    9961234                    slidesToScroll: 1, // Scroll 1 slide at a time
    997                     autoplay: false,    // Enable autoplay
     1235                    autoplay: false, // Enable autoplay
    9981236                    autoplaySpeed: 2000, // 2 seconds autoplay speed
    9991237                    dots: true,
    10001238                    arrows: false,
    10011239                    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
    10161245                        }
     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                    }
    10171254                    ]
    10181255                });
  • post-types-slider/trunk/admin/partials/post-type-slider-admin-metaboxes.php

    r3433570 r3438775  
    1212            <button class="tab-btn <?php echo isset($_GET['tab']) && $_GET['tab'] == 'customize' ? 'active' : '' ?>"
    1313                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' : '' ?>"
    1515                data-tab="template">Template</button>
    1616            <?php do_action('pt_slider_admin_more_tabs', $post); ?>
     
    165165                            <tr>
    166166                                <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>
    168168                            </tr>
    169169                            <tr>
    170170                                <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>
    172172                            </tr>
    173173                            <tr>
  • post-types-slider/trunk/includes/class-post-type-slider-activator.php

    r3367949 r3438775  
    3232     */
    3333    public static function activate()
    34     {   
    35         $setting= get_option('posttysl_settings', true);
     34    {
    3635
    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         );
    6636
    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);
    6872        }
    6973    }
  • post-types-slider/trunk/includes/class-post-type-slider-deactivator.php

    r3284786 r3438775  
    3131     */
    3232    public static function deactivate() {
    33 
     33       
     34        do_action( 'appsero_tracker_deactivated' );
    3435        unregister_post_type('slide');
     36        delete_option('posttysl_settings');
    3537    }
    3638
  • post-types-slider/trunk/includes/class-post-type-slider.php

    r3284786 r3438775  
    117117        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-post-type-slider-admin.php';
    118118
     119        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/widget/elementor/elementor-post-type-slider-widget.php';
    119120        /**
    120121         * The class responsible for defining all actions that occur in the public-facing
  • post-types-slider/trunk/post-types-slider.php

    r3433570 r3438775  
    1717 * Plugin URI:        https://clickysoft.com
    1818 * 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.6
     19 * Version:           1.0.7
    2020 * Author:            Clickysoft
    2121 * Author URI:        https://clickysoft.com/
     
    6666 */
    6767require plugin_dir_path(__FILE__) . 'includes/class-post-type-slider.php';
     68require __DIR__ . '/vendor/autoload.php';
     69
     70
     71
     72/**
     73 * Initialize the plugin tracker
     74 *
     75 * @return void
     76 */
     77function 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
     101appsero_init_tracker_post_types_slider();
     102
     103
    68104
    69105/**
  • post-types-slider/trunk/public/css/post-type-slider-public.css

    r3433570 r3438775  
    88.thumbnail img {
    99    width: 100% !important;
    10     height: 300px !important;
     10    /* height: 300px !important; */
    1111    object-fit: cover;
    1212}
     
    2828}
    2929
    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;
    3737}
    3838
     
    4040    border: none !important;
    4141}
     42
     43a.ajax_add_to_cart.p_disabled {
     44    pointer-events: none;
     45    background-color: #9e9e9e !important;
     46    /* color: black !important; */
     47}
     48
    4249
    4350.post_slide h2 {
     
    5360.post_type_grid {
    5461    display: grid !important;
    55     gap: 20px; /* space between cards */
     62    gap: 20px;
     63    /* space between cards */
    5664}
    5765
     
    8997}
    9098
     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
     112a.ajax_add_to_cart.p_enabled.variable_btn.disabled {
     113    background: #8080806e !important;
     114}
    91115
    92116ul.slick-dots {
     
    128152
    129153.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}
    135173
    136174
    137175p.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
    142182.post_type_grid .post_slide {
    143183    /* width: 32%; */
     
    149189.post_type_slider button.slick-prev.slick-arrow {
    150190
    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 {
    157197    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;
    172214    text-decoration: none !important;
    173215}
    174216
    175217.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;
    181223    z-index: 9999;
    182224    /* background: black; */
     
    197239    .post_type_grid .post_slide {
    198240
    199         width: 100%;
     241        width: 100% !important;
    200242    }
    201243
    202244    .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;
    205248    }
    206249
     
    229272}
    230273
    231 @media (min-width: 320px) and (max-width: 529px){
     274@media (min-width: 320px) and (max-width: 529px) {
    232275
    233276    .post_type_slider button.slick-next.slick-arrow {
    234       right: 0%;
    235     }
     277        right: 0%;
     278    }
     279
    236280    .post_type_slider button.slick-prev.slick-arrow {
    237281        left: 0%;
    238282    }
    239283}
     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  
    6565        // });
    6666
    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) {
    6868            e.preventDefault();
    6969            var $this = jQuery(this);
     
    8383                    },
    8484                    beforeSend: function () {
    85                        
     85
    8686                        $this.html('Adding <img src="' + loder + '" alt="Loading..." style="width:20px;height:20px;"/>');
    8787                        // $this.text("Adding...");
     
    9292
    9393                            $this.text("Added");
    94                             setTimeout(() => {
    95                                 $this.text("Add to Cart");
    96                             }, 2000);
     94                            // setTimeout(() => {
     95                            // $this.text("Add to Cart");
     96                            // }, 2000);
    9797                        }
    9898                    },
     
    105105        })
    106106
     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
    107167    })
    108168
Note: See TracChangeset for help on using the changeset viewer.