Changeset 3433570
- Timestamp:
- 01/06/2026 12:22:22 PM (3 months ago)
- Location:
- post-types-slider
- Files:
-
- 1 added
- 12 edited
-
tags/1.0.4/README.txt (modified) (1 diff)
-
tags/1.0.4/admin/images/logo.png (added)
-
tags/1.0.4/post-types-slider.php (modified) (1 diff)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/admin/class-post-type-slider-admin.php (modified) (19 diffs)
-
trunk/admin/css/post-type-slider-admin.css (modified) (1 diff)
-
trunk/admin/js/post-type-slider-admin.js (modified) (1 diff)
-
trunk/admin/partials/post-type-slider-admin-metaboxes.php (modified) (10 diffs)
-
trunk/includes/class-post-type-slider-loader.php (modified) (1 diff)
-
trunk/post-types-slider.php (modified) (2 diffs)
-
trunk/public/class-post-type-slider-public.php (modified) (2 diffs)
-
trunk/public/css/post-type-slider-public.css (modified) (4 diffs)
-
trunk/public/js/post-type-slider-public.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
post-types-slider/tags/1.0.4/README.txt
r3367949 r3433570 5 5 Tested up to: 6.7 6 6 Requires PHP: 7.4 7 Stable tag: 1.0. 57 Stable tag: 1.0.4 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html -
post-types-slider/tags/1.0.4/post-types-slider.php
r3367949 r3433570 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. 519 * Version: 1.0.4 20 20 * Author: Clickysoft 21 21 * Author URI: https://clickysoft.com/ -
post-types-slider/trunk/README.txt
r3369600 r3433570 5 5 Tested up to: 6.7 6 6 Requires PHP: 7.4 7 Stable tag: 1.0. 57 Stable tag: 1.0.6 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 77 77 == Changelog == 78 78 79 = 1.0.6 = 80 * Improved: Data validation & formatting 81 * Request handling validation 82 * Tabs functions 83 79 84 = 1.0.5 = 80 85 * Improved: Improvements on the slider functionality. -
post-types-slider/trunk/admin/class-post-type-slider-admin.php
r3369600 r3433570 67 67 add_action("admin_menu", [$this, 'posttysl_add_admin_menu']); 68 68 add_action('admin_init', [$this, 'postslider_save_options']); 69 add_action('wp_ajax_post_slider_add_to_cart', [$this, 'post_slider_add_to_cart']); 70 add_action('wp_ajax_nopriv_post_slider_add_to_cart', [$this, 'post_slider_add_to_cart']); 69 71 70 72 } … … 170 172 171 173 172 } 174 } 173 175 174 176 /** … … 189 191 { 190 192 191 add_meta_box(192 'slider_details',193 'Slider Options',194 [$this, 'postslider_metabox'],195 'posttysl_slide',196 'advanced',197 'default'198 );199 193 add_meta_box( 200 194 'slider_display2', … … 205 199 'default' 206 200 ); 201 add_meta_box( 202 'slider_detail', 203 'Slider Options', 204 [$this, 'postslider_metabox'], 205 'posttysl_slide', 206 'advanced', 207 'default' 208 ); 207 209 } 208 210 … … 215 217 // ob_start(); 216 218 if ($post->ID) { 219 217 220 218 221 include plugin_dir_path(__FILE__) . 'partials/post-type-slider-admin-metabox-shortcode.php'; … … 335 338 $slider_category = get_post_meta($post->ID, '_slider_category', true); 336 339 $post_order = get_post_meta($post->ID, '_post_order', true); 340 $grid_layout = get_post_meta($post->ID, '_grid_layout', true); 337 341 $post_categery_term = get_post_meta($post->ID, '_post_category_term', true); 338 342 $taxonomies = get_object_taxonomies($slider_posttype, 'objects'); 339 343 $terms = get_terms(['taxonomy' => $slider_post_category, 'hide_empty' => false]); 340 $opts = get_post_meta($post->ID, $this->option_name)[0]; 344 $opts = get_post_meta($post->ID, $this->option_name); 345 if (isset($opts[0])) { 346 $opts = $opts[0]; 347 } 348 341 349 // var_dump($opts); 342 350 $post_type = get_post_types( … … 368 376 } 369 377 378 379 /** 380 * Ajax Call for add to cart product 381 * 382 */ 383 public function post_slider_add_to_cart() 384 { 385 386 if (!isset($_POST['product_id']) || !isset($_POST['quantity']) || !isset($_POST['nonce']) || !wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['nonce'])), 'product_nonce')) { 387 wp_send_json_error(['message' => 'Invalid request']); 388 } 389 390 $product_id = intval($_POST['product_id']); 391 $quantity = intval($_POST['quantity']); 392 393 if ($product_id <= 0 || $quantity <= 0) { 394 wp_send_json_error(['message' => 'Invalid product or quantity']); 395 } 396 397 if (!class_exists('WC_Cart')) { 398 wp_send_json_error(['message' => 'WooCommerce is not active']); 399 } 400 401 $added = WC()->cart->add_to_cart($product_id, $quantity); 402 403 if ($added) { 404 wp_send_json_success(['success' => true, 'message' => 'Product added to cart']); 405 } else { 406 wp_send_json_error(['success' => false, 'message' => 'Failed to add product to cart']); 407 } 408 } 409 370 410 /** 371 411 * Save post meta data … … 419 459 if (isset($_POST['post_order'])) { 420 460 update_post_meta($post_id, '_post_order', sanitize_text_field(wp_unslash($_POST['post_order']))); 461 } 462 if (isset($_POST['post_order'])) { 463 update_post_meta($post_id, '_grid_layout', sanitize_text_field(wp_unslash($_POST['grid_layout']))); 421 464 } 422 465 … … 433 476 $data['show_image'] = isset($_POST['show_image']) ? '1' : '0'; 434 477 $data['show_button'] = isset($_POST['show_button']) ? '1' : '0'; 478 $data['ajax_button'] = isset($_POST['ajax_button']) ? '1' : '0'; 435 479 $data['show_date'] = isset($_POST['show_date']) ? '1' : '0'; 436 480 $data['show_category'] = isset($_POST['show_category']) ? '1' : '0'; … … 455 499 $data['button_style'] = sanitize_text_field($_POST['button_style']); 456 500 $data['button_padding'] = sanitize_text_field($_POST['button_padding']); 501 $data['button_text'] = sanitize_text_field($_POST['button_text']); 457 502 $data['cards_per_row'] = sanitize_text_field($_POST['cards_per_row']); 458 503 $data['grid_gap'] = sanitize_text_field($_POST['grid_gap']); … … 465 510 466 511 update_post_meta($post_id, $this->option_name, $data); 512 467 513 468 514 // if (isset($_POST['s_title'])) { … … 517 563 $data['button_style'] = sanitize_text_field($_POST['button_style']); 518 564 $data['button_padding'] = sanitize_text_field($_POST['button_padding']); 565 $data['button_text'] = sanitize_text_field($_POST['button_text']); 519 566 $data['cards_per_row'] = sanitize_text_field($_POST['cards_per_row']); 520 567 $data['grid_gap'] = sanitize_text_field($_POST['grid_gap']); … … 650 697 if ($taxonomies) { 651 698 foreach ($taxonomies as $tax) { 652 if (!in_array($tax->name, $exclude)) {653 // Append the taxonomy name and label to the array654 $taxonomy_data[] = [655 'name' => esc_attr($tax->name),656 'label' => esc_html($tax->label),657 ];658 }699 if (!in_array($tax->name, $exclude)) { 700 // Append the taxonomy name and label to the array 701 $taxonomy_data[] = [ 702 'name' => esc_attr($tax->name), 703 'label' => esc_html($tax->label), 704 ]; 705 } 659 706 } 660 707 } … … 723 770 $all_category = get_post_meta($id, '_all_category', true); 724 771 $order = get_post_meta($id, '_post_order', true); 725 726 $button_text = $post_type == 'product' ? 'Shop Now' : 'Read More'; 772 $layout = get_post_meta($id, '_grid_layout', true); 773 774 $button_text = $slider_settings['button_text'] ? $slider_settings['button_text'] : 'Read More'; 727 775 $post_column = $slider_settings['cards_per_row']; 728 776 $s_dots = $slider_settings['dots']; … … 759 807 $posts = get_posts($args); 760 808 761 762 809 if ($posts) { 763 810 764 $html .= "<div class='" . $class . "'>"; 811 812 $html .= ''; 813 $html .= apply_filters('post_slider_before_grid', $html); 814 $html .= "<div class='" . $class . " slider_layout" . $layout . "'>"; 765 815 foreach ($posts as $post) { 766 816 767 $date = get_the_date('d-M-Y');768 $terms = wp_get_post_terms($post->ID, $slider_post_category, ['fields'=> 'names']) ? wp_get_post_terms($post->ID, $slider_post_category, ['fields'=> 'names']) : '';817 $date = get_the_date('d-M-Y'); 818 $terms = wp_get_post_terms($post->ID, $slider_post_category, ['fields' => 'names']) ? wp_get_post_terms($post->ID, $slider_post_category, ['fields' => 'names']) : ''; 769 819 $post_terms = ''; 770 foreach($terms as $term){ 771 772 $post_terms.="<span>".$term."</span>"; 820 $class = $slider_settings['ajax_button'] == '1' && $post_type == 'product' ? 'ajax_add_to_cart' : ''; 821 822 if (is_array($terms)) { 823 824 foreach ($terms as $term) { 825 826 $post_terms .= "<span>" . $term . "</span>"; 827 } 773 828 } 774 829 $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; '>"; … … 780 835 $html .= " 781 836 <div class='post_content'>"; 782 783 837 if ($slider_settings['show_title'] == '1') { 784 $html .= "<h2 style='font-size:" . $slider_settings['font_title'] . "px; color:" . $slider_settings['title_color'] . "'>" . get_the_title($post->ID) . "</h2>";838 $html .= "<h2 style='font-size:" . $slider_settings['font_title'] . "px; color:" . $slider_settings['title_color'] . "'>" . substr(get_the_title($post->ID), 0, 60) . "</h2>"; 785 839 } 786 840 787 $html .="<div class='post_meta'>"; 788 $slider_settings['show_date'] == '1' ? $html .= "<p class='meta_date'>Date: ".$date."</p>" : ''; 789 $slider_settings['show_category'] == '1' && $terms ? $html .= "<p class='meta_category'>".$post_terms."</p>" : ''; 790 $html .="</div>"; 791 841 $html .= "<div class='post_meta'>"; 842 $slider_settings['show_date'] == '1' ? $html .= "<p class='meta_date'>Date: " . $date . "</p>" : ''; 843 $slider_settings['show_category'] == '1' && $terms ? $html .= "<p class='meta_category'>" . $post_terms . "</p>" : ''; 844 $html .= "</div>"; 845 846 if ($post_type == 'product') { 847 $price = get_post_meta($post->ID, '_price', true); 848 $currency = get_woocommerce_currency_symbol(); 849 $html .= "<p class='product_price'>Price: {$currency}{$price} </p>"; 850 } 792 851 if ($slider_settings['show_description'] == '1') { 793 852 $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>"; … … 795 854 796 855 if ($slider_settings['show_button'] == '1') { 797 $html .= "<div class='readmore'><ahref='" . get_the_permalink($post->ID) . "'856 $html .= "<div class='readmore'><a class='" . $class . "' data-id='" . $post->ID . "' href='" . get_the_permalink($post->ID) . "' 798 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') . ";'> 799 858 " . $button_text . "</a></div>"; 800 859 } 801 860 802 $html .= "</div>861 $html .= "</div> 803 862 </div>"; 804 } 805 863 864 } 806 865 $html .= "</div>"; 807 } 808 866 $html = apply_filters('post_slider_after_grid', $html); 867 } 868 869 ob_start(); 809 870 ?> 810 871 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> … … 814 875 background: 815 876 <?php echo $arrow_color; ?> 816 ;877 !important; 817 878 818 879 } … … 870 931 871 932 <?php 872 return $html; 933 934 return $html . ob_get_clean(); 873 935 874 936 } -
post-types-slider/trunk/admin/css/post-type-slider-admin.css
r3369600 r3433570 16 16 margin-top: 10px; 17 17 } 18 18 19 19 20 -
post-types-slider/trunk/admin/js/post-type-slider-admin.js
r3369600 r3433570 194 194 // }); 195 195 196 197 // const value= jQuery(document).find(".postysl_metaboxes #slider_type").val(); 198 // if(value == 'grid'){ 199 200 // jQuery(".horizontal_tabs button[data-tab='template']").fadeIn(); 201 // }else{ 202 // jQuery(".horizontal_tabs button[data-tab='template']").fadeOut(); 203 // } 204 205 jQuery(document).on("change", "#slider_type", function () { 206 207 const value = jQuery(this).val(); 208 console.log(value); 209 if (value == 'grid') { 210 211 jQuery(".horizontal_tabs button[data-tab='template']").fadeIn(); 212 } else { 213 jQuery(".horizontal_tabs button[data-tab='template']").fadeOut(); 214 } 215 }) 216 217 // AJax call for product add to cart 218 196 219 })(jQuery); -
post-types-slider/trunk/admin/partials/post-type-slider-admin-metaboxes.php
r3369600 r3433570 2 2 <div class="pt-tabs"> 3 3 <nav class="tab-nav horizontal_tabs"> 4 <button class="tab-btn <?php echo empty($_GET['tab']) || $_GET['tab'] == 'type'? 'active' : '' ?>"4 <button class="tab-btn <?php echo isset($_GET['tab']) && ($_GET['tab'] == 'type' || empty($_GET['tab'])) ? 'active' : '' ?>" 5 5 data-tab="type">Type</button> 6 <button class="tab-btn <?php echo $_GET['tab'] == 'posttype' ? 'active' : '' ?>" data-tab="posttype">Post6 <button class="tab-btn <?php echo isset($_GET['tab']) && $_GET['tab'] == 'posttype' ? 'active' : '' ?>" data-tab="posttype">Post 7 7 Type</button> 8 <button class="tab-btn <?php echo $_GET['tab'] == 'categories' ? 'active' : '' ?>"8 <button class="tab-btn <?php echo isset($_GET['tab']) && $_GET['tab'] == 'categories' ? 'active' : '' ?>" 9 9 data-tab="categories">Categories</button> 10 <button class="tab-btn <?php echo $_GET['tab'] == 'sorting' ? 'active' : '' ?>"10 <button class="tab-btn <?php echo isset($_GET['tab']) && $_GET['tab'] == 'sorting' ? 'active' : '' ?>" 11 11 data-tab="sorting">Sorting</button> 12 <button class="tab-btn <?php echo $_GET['tab'] == 'customize' ? 'active' : '' ?>"12 <button class="tab-btn <?php echo isset($_GET['tab']) && $_GET['tab'] == 'customize' ? 'active' : '' ?>" 13 13 data-tab="customize">Customize</button> 14 14 <button style="display:<?php echo $slider_type == 'grid' ? 'block' : 'none'; ?>" class="tab-btn <?php echo isset($_GET['tab']) && $_GET['tab'] == 'template' ? 'active' : '' ?>" 15 data-tab="template">Template</button> 16 <?php do_action('pt_slider_admin_more_tabs', $post); ?> 15 17 </nav> 16 18 … … 37 39 </section> 38 40 39 <section class="tab-panel <?php echo $_GET['tab'] == 'posttype' ? 'active' : '' ?>" id="tab-posttype">41 <section class="tab-panel <?php echo isset($_GET['tab']) && $_GET['tab'] == 'posttype' ? 'active' : '' ?>" id="tab-posttype"> 40 42 <!-- <h2>Post Type</h2> --> 41 43 <table class="form-table"> … … 61 63 </section> 62 64 63 <section class="tab-panel <?php echo $_GET['tab'] == 'categories' ? 'active' : '' ?>" id="tab-categories">65 <section class="tab-panel <?php echo isset($_GET['tab']) && $_GET['tab'] == 'categories' ? 'active' : '' ?>" id="tab-categories"> 64 66 <!-- <h2>Categories</h2> --> 65 67 <table class="form-table"> … … 107 109 </section> 108 110 109 <section class="tab-panel <?php echo $_GET['tab'] == 'sorting' ? 'active' : '' ?>" id="tab-sorting">111 <section class="tab-panel <?php echo isset($_GET['tab']) && $_GET['tab'] == 'sorting' ? 'active' : '' ?>" id="tab-sorting"> 110 112 <!-- <h2>Sorting</h2> --> 111 113 <table class="form-table"> … … 124 126 </table> 125 127 </section> 126 <section class="tab-panel <?php echo $_GET['tab'] == 'customize' ? 'active' : '' ?>" id="tab-customize">128 <section class="tab-panel <?php echo isset($_GET['tab']) && $_GET['tab'] == 'customize' ? 'active' : '' ?>" id="tab-customize"> 127 129 <div class="pt-tabs"> 128 130 <nav class="tab-nav"> … … 152 154 <td><label><input type="checkbox" name="show_image" <?php echo (!isset($opts['show_image']) || $opts['show_image'] == '1') ? 'checked="checked"' : ''; ?> /> Enable</label></td> 153 155 </tr> 154 <tr>156 <tr> 155 157 <th>Show Button</th> 156 158 <td><label><input type="checkbox" name="show_button" <?php echo (!isset($opts['show_button']) || $opts['show_button'] == '1') ? 'checked="checked"' : ''; ?> /> Enable</label></td> 157 159 </tr> 160 <tr style="display:<?php echo $slider_posttype == 'product' ? 'contents': 'none'; ?>;"> 161 <th>Enable Ajax</th> 162 <td><label><input type="checkbox" name="ajax_button" <?php echo (!isset($opts['ajax_button']) || $opts['ajax_button'] == '1') ? 'checked="checked"' : ''; ?> /> Enable</label></td> 163 </tr> 164 158 165 <tr> 159 166 <th>Show Category</th> 160 <td><label><input type="checkbox" name="show_category" <?php checked('1', $opts['show_category']); ?> /> 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> 161 168 </tr> 162 169 <tr> 163 170 <th>Show Date</th> 164 <td><label><input type="checkbox" name="show_date" <?php checked('1', $opts['show_date']); ?> /> 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> 165 172 </tr> 166 173 <tr> … … 302 309 </td> 303 310 </tr> 311 <tr> 312 <th>Button Text</th> 313 <td><input type="text" name="button_text" 314 value="<?php echo !isset($opts['button_text']) ? 'Read More' : esc_attr($opts['button_text']); ?>" /> 315 </td> 316 </tr> 304 317 </table> 305 318 </section> … … 307 320 </div> 308 321 </section> 322 <section class="tab-panel <?php echo isset($_GET['tab']) && $_GET['tab'] == 'template' ? 'active' : '' ?>" id="tab-template"> 323 <h2>Display</h2> 324 <div class="display_presets"> 325 <div class="layout-options"> 326 <label class="layout-option"> 327 <input type="radio" name="grid_layout" value="1" <?php echo $grid_layout == '1' ? 'checked="checked"' : ''; ?>> 328 <span class="layout-1"> 329 <div></div> 330 </span> 331 </label> 332 333 <label class="layout-option"> 334 <input type="radio" name="grid_layout" value="2" <?php echo $grid_layout == '2' ? 'checked="checked"' : ''; ?>> 335 <span class="layout-2"> 336 <div></div> 337 <div></div> 338 </span> 339 </label> 340 341 <label class="layout-option"> 342 <input type="radio" name="grid_layout" value="3" <?php echo $grid_layout == '3' ? 'checked="checked"' : ''; ?>> 343 <span class="layout-3"> 344 <div></div> 345 <div></div> 346 </span> 347 </label> 348 349 <label class="layout-option"> 350 <input type="radio" name="grid_layout" value="4" <?php echo $grid_layout == '4' ? 'checked="checked"' : ''; ?>> 351 <span class="layout-4"> 352 <div></div> 353 <div></div> 354 </span> 355 </label> 356 357 <label class="layout-option"> 358 <input type="radio" name="grid_layout" value="5" <?php echo $grid_layout == '5' ? 'checked="checked"' : ''; ?>> 359 <span class="layout-5"> 360 <div></div> 361 <div></div> 362 <div></div> 363 </span> 364 </label> 365 366 <label class="layout-option"> 367 <input type="radio" name="grid_layout" value="6" <?php echo $grid_layout == '6' ? 'checked="checked"' : ''; ?>> 368 <span class="layout-6"> 369 <div></div> 370 <div></div> 371 <div></div> 372 <div></div> 373 </span> 374 </label> 375 376 <label class="layout-option"> 377 <input type="radio" name="grid_layout" value="7" <?php echo $grid_layout == '7' ? 'checked="checked"' : ''; ?>> 378 <span class="layout-7"> 379 <div></div> 380 <div></div> 381 <div></div> 382 <div></div> 383 <div></div> 384 </span> 385 </label> 386 387 <label class="layout-option"> 388 <input type="radio" name="grid_layout" value="8" <?php echo $grid_layout == '8' ? 'checked="checked"' : ''; ?>> 389 <span class="layout-8"> 390 <div></div> 391 <div></div> 392 <div></div> 393 </span> 394 </label> 395 </div> 396 </div> 397 </section> 398 <?php do_action('pt_slider_admin_more_tab_content', $post); ?> 309 399 </div> 310 400 </div> … … 486 576 width: 70% !important; 487 577 } 578 579 .layout-options { 580 display: flex; 581 flex-wrap: wrap; 582 gap: 15px; 583 } 584 585 .layout-option { 586 position: relative; 587 width: 22%; 588 height: 100px; 589 border: 2px solid #00aaff; 590 display: grid; 591 cursor: pointer; 592 transition: 0.2s ease; 593 } 594 595 .layout-option input { 596 display: none; 597 } 598 599 .layout-option span div { 600 601 border: 1px solid #00aaff; 602 } 603 604 .layout-option span { 605 width: 100%; 606 height: 100%; 607 display: grid; 608 } 609 610 .layout-option input:checked+span { 611 border: 2px solid orange; 612 box-shadow: 0 0 5px rgba(255, 165, 0, 0.7); 613 } 614 615 /* Different grid styles */ 616 .layout-1 { 617 grid-template-columns: 1fr; 618 } 619 620 .layout-2 { 621 grid-template-columns: 1fr 1fr; 622 } 623 624 .layout-3 { 625 grid-template-columns: 1fr 2fr; 626 } 627 628 .layout-4 { 629 grid-template-columns: 2fr 1fr; 630 } 631 632 .layout-5 { 633 grid-template-columns: 1fr 1fr 1fr; 634 } 635 636 .layout-6 { 637 grid-template-columns: 1fr 1fr 1fr 1fr; 638 } 639 640 .layout-7 { 641 grid-template-columns: 1fr 1fr 1fr 1fr 1fr; 642 } 643 644 .layout-8 { 645 grid-template-columns: 1fr 2fr 1fr; 646 } 488 647 </style> 489 648 … … 539 698 // frame.open(); 540 699 // }); 700 701 const value = jQuery("#slider_type").val(); 702 if (value == 'grid') { 703 704 jQuery(".horizontal_tabs button[data-tab='template']").fadeIn(); 705 } else { 706 jQuery(".horizontal_tabs button[data-tab='template']").fadeOut(); 707 } 708 541 709 }); 542 710 -
post-types-slider/trunk/includes/class-post-type-slider-loader.php
r3284786 r3433570 82 82 } 83 83 84 public function add_shortcode( $hook, $component, $callback ) { 85 $this->filters = $this->add( $this->filters, $hook, $component, $callback, 10, 1 ); 86 } 87 84 88 /** 85 89 * A utility function that is used to register the actions and hooks into a single -
post-types-slider/trunk/post-types-slider.php
r3367949 r3433570 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. 519 * Version: 1.0.6 20 20 * Author: Clickysoft 21 21 * Author URI: https://clickysoft.com/ … … 27 27 28 28 // If this file is called directly, abort. 29 if (! defined('WPINC')) {29 if (!defined('WPINC')) { 30 30 die; 31 31 } -
post-types-slider/trunk/public/class-post-type-slider-public.php
r3284786 r3433570 103 103 wp_enqueue_script('slick-js', plugin_dir_url(__FILE__) . 'js/slick.js', array('jquery'), $this->version, true); 104 104 wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__) . 'js/post-type-slider-public.js', array('jquery', 'slick-js'), $this->version, false); 105 } 105 wp_localize_script($this->plugin_name, 'post_handler', ['ajax_url' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('product_nonce'), 'post_loader'=> plugin_dir_url(__FILE__).'images/loader.gif']); 106 107 } 106 108 107 109 /** … … 110 112 */ 111 113 112 public function post_slider_shortcode($atts)113 {114 // public function post_slider_shortcode($atts) 115 // { 114 116 115 ob_start();116 $atts = shortcode_atts(117 [118 'id' => 1119 ],120 $atts,121 'ptslider'122 );117 // // ob_start(); 118 // // $atts = shortcode_atts( 119 // // [ 120 // // 'id' => 1 121 // // ], 122 // // $atts, 123 // // 'ptslider' 124 // // ); 123 125 124 if ($atts['id']) {126 // // if ($atts['id']) { 125 127 126 $posts = get_post($atts['id']); 128 // // $posts = get_post($atts['id']); 129 // // var_dump($posts); 127 130 128 }131 // // } 129 132 130 ob_end_clean(); 131 } 133 // echo "hello woeld"; 134 // // ob_end_clean(); 135 // } 132 136 } -
post-types-slider/trunk/public/css/post-type-slider-public.css
r3369600 r3433570 44 44 color: black; 45 45 font-size: 24px; 46 line-height: 33px;46 line-height: 27px; 47 47 margin: 0 !important; 48 48 padding: 10px 0; 49 49 } 50 50 51 52 /* Common grid wrapper */ 53 .post_type_grid { 54 display: grid !important; 55 gap: 20px; /* space between cards */ 56 } 57 58 /* Layout styles */ 59 .slider_layout1 { 60 grid-template-columns: 1fr; 61 } 62 63 .slider_layout2 { 64 grid-template-columns: 1fr 1fr; 65 } 66 67 .slider_layout3 { 68 grid-template-columns: 1fr 2fr; 69 } 70 71 .slider_layout4 { 72 grid-template-columns: 2fr 1fr; 73 } 74 75 .slider_layout5 { 76 grid-template-columns: 1fr 1fr 1fr; 77 } 78 79 .slider_layout6 { 80 grid-template-columns: 1fr 1fr 1fr 1fr; 81 } 82 83 .slider_layout7 { 84 grid-template-columns: 1fr 1fr 1fr 1fr 1fr; 85 } 86 87 .slider_layout8 { 88 grid-template-columns: 1fr 2fr 1fr; 89 } 90 91 51 92 ul.slick-dots { 52 93 list-style: none; … … 54 95 justify-content: center; 55 96 align-items: center; 56 gap: 20px;97 gap: 15px; 57 98 margin: 14px 0; 58 99 } … … 66 107 ul.slick-dots li button { 67 108 border: none; 68 padding: 5px 10px;109 padding: 0px 4px; 69 110 color: white !important; 70 111 } … … 76 117 gap: 20px; 77 118 /* justify-content: center; */ 78 align-items: center; 79 } 80 119 align-items: start; 120 } 121 122 123 .ajax_add_to_cart img { 124 125 width: 20px !important; 126 height: 20px !important; 127 } 128 129 .ajax_add_to_cart { 130 align-items:center; 131 gap:5px; 132 display:flex; 133 } 134 135 136 137 p.product_price { 138 font-size:18px; 139 color:black; 140 font-weight:600; 141 } 81 142 .post_type_grid .post_slide { 82 width: 32%; 143 /* width: 32%; */ 144 width: 100%; 83 145 padding: 10px; 84 146 box-shadow: 0px 2px 6px 2px #d3d3d34d; -
post-types-slider/trunk/public/js/post-type-slider-public.js
r3366379 r3433570 64 64 // centerMode: true, // Centers the active slide 65 65 // }); 66 67 jQuery(document).on("click", ".readmore .ajax_add_to_cart", function (e) { 68 e.preventDefault(); 69 var $this = jQuery(this); 70 var id = jQuery(this).data("id"); 71 var loder = post_handler.post_loader; 72 // console.log(id); 73 var nonce = post_handler.nonce; 74 if (id) { 75 jQuery.ajax({ 76 type: "POST", 77 url: post_handler.ajax_url, 78 data: { 79 action: 'post_slider_add_to_cart', 80 product_id: id, 81 nonce: nonce, 82 quantity: 1 83 }, 84 beforeSend: function () { 85 86 $this.html('Adding <img src="' + loder + '" alt="Loading..." style="width:20px;height:20px;"/>'); 87 // $this.text("Adding..."); 88 }, 89 success: function (response) { 90 91 if (response.success) { 92 93 $this.text("Added"); 94 setTimeout(() => { 95 $this.text("Add to Cart"); 96 }, 2000); 97 } 98 }, 99 complete: function () { 100 101 // Reset flag if re-triggering is allowed after completion 102 } 103 }); 104 } 105 }) 106 66 107 }) 67 108
Note: See TracChangeset
for help on using the changeset viewer.