Changeset 2192699
- Timestamp:
- 11/14/2019 11:46:13 AM (5 years ago)
- Location:
- post-carousel-for-dv-builder/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
post-carousel-for-dv-builder/trunk/includes/postcarousel.php
r2132707 r2192699 18 18 'toggles' => array( 19 19 'main_content' => esc_html__( 'Content', 'et_builder' ), 20 'post_background' => esc_html__( 'Post Background', 'et_builder' ), 20 21 'elements' => esc_html__( 'Elements', 'et_builder' ), 21 22 'featured_image' => esc_html__( 'Featured Image', 'et_builder' ), … … 214 215 $post_types = get_post_types( array('public' => true) ); 215 216 $post_types = array_map('ucfirst', $post_types); 217 $post_typesarr = get_post_types( array('public' => true) ); 218 $post_types = array_map('ucfirst', $post_types); 219 $taxonomyfields = array(); 220 if($post_types) { 221 $cats = array(); 222 foreach($post_typesarr as $type) { 223 $taxonomies = get_object_taxonomies( array( 'post_type' => $type ) ); 224 $taxoArr = array(); 225 if($taxonomies && count($taxonomies)) { 226 $termsArr = array(); 227 foreach($taxonomies as $tax) { 228 $taxonomy_details = get_taxonomy( $tax ); 229 $taxoArr[$tax] = $taxonomy_details->label; 230 $termsData = get_terms( 231 array( 232 'taxonomy' => $tax, 233 'hide_empty' => true 234 ) 235 ); 236 if($termsData && count($termsData)) { 237 foreach($termsData as $td) { 238 $termsArr[$td->slug] = $td->name; 239 } 240 } 241 } 242 $taxonomyfields['include_taxonomy_'.$type] = array( 243 'label' => esc_html__( 'Select Taxonomy', 'et_builder' ), 244 'type' => 'select', 245 'option_category' => 'basic_option', 246 'options' => $taxoArr, 247 'toggle_slug' => 'main_content', 248 'show_if' => array( 249 'selected_post_type' => array( $type ), 250 ), 251 ); 252 foreach($taxonomies as $tax) { 253 $taxonomyfields['include_cat_'.$tax] = array( 254 'label' => esc_html__( 'Select Category', 'et_builder' ), 255 'type' => 'categories', 256 'option_category' => 'basic_option', 257 'description' => esc_html__( 'Choose post type you would like to display in the carousel.', 'et_builder' ), 258 'toggle_slug' => 'main_content', 259 'show_if' => array( 260 'selected_post_type' => array( $type ), 261 ), 262 'taxonomy_name' => $tax, 263 'toggle_slug' => 'main_content', 264 'show_if' => array( 265 'include_taxonomy_'.$type => array( $tax ), 266 'selected_post_type' => array( $type ), 267 ), 268 ); 269 } 270 } 271 } 272 } 216 273 $fields = array( 217 274 'selected_post_type' => array( … … 222 279 'toggle_slug' => 'main_content', 223 280 'computed_affects' => array( 224 '__ posts',281 '__fhcallback', 225 282 ), 226 283 ), … … 236 293 'default' => 10, 237 294 'computed_affects' => array( 238 '__posts', 239 ), 240 ), 241 /*'include_categories' => array( 242 'label' => esc_html__( 'Include Categories', 'et_builder' ), 243 'type' => 'text', 244 'option_category' => 'basic_option', 245 'renderer_options' => array( 246 'use_terms' => false, 247 ), 248 'description' => esc_html__( 'Enter ids of categories you would like to include in the carousel ( Comma separated ).', 'et_builder' ), 249 'toggle_slug' => 'main_content', 250 'computed_affects' => array( 251 '__posts', 252 ), 253 ),*/ 295 '__fhcallback', 296 ), 297 ), 298 299 ); 300 301 foreach($taxonomyfields as $key => $tax) { 302 $fields[$key] = $tax; 303 } 304 305 $fieldPart2 = array( 254 306 'orderby' => array( 255 307 'label' => esc_html__( 'Order By', 'et_builder' ), … … 266 318 'description' => esc_html__( 'Here you can adjust the order in which posts are displayed.', 'et_builder' ), 267 319 'computed_affects' => array( 268 '__ posts',320 '__fhcallback', 269 321 ), 270 322 'default_on_front' => 'date_desc', 323 ), 324 'post_bg' => array( 325 'label' => esc_html__( 'Post Item Background Color', 'et_builder' ), 326 'type' => 'color-alpha', 327 'custom_color' => true, 328 'toggle_slug' => 'post_background', 329 'default' => '#fff', 330 'description' => esc_html__( 'This setting will apply background color to post item ignored if featured image placement was set to background.', 'et_builder' ), 271 331 ), 272 332 'show_arrows' => array( … … 335 395 'toggle_slug' => 'main_content', 336 396 'computed_affects' => array( 337 '__ posts',397 '__fhcallback', 338 398 ), 339 399 ), … … 351 411 'toggle_slug' => 'main_content', 352 412 'computed_affects' => array( 353 '__ posts',413 '__fhcallback', 354 414 ), 355 415 ), … … 363 423 'toggle_slug' => 'main_content', 364 424 'computed_affects' => array( 365 '__ posts',425 '__fhcallback', 366 426 ), 367 427 ), … … 441 501 'toggle_slug' => 'carousel', 442 502 'computed_affects' => array( 443 '__ posts',503 '__fhcallback', 444 504 ), 445 505 ), … … 469 529 'toggle_slug' => 'carousel', 470 530 'computed_affects' => array( 471 '__ posts',531 '__fhcallback', 472 532 ), 473 533 'mobile_options' => true, … … 502 562 'toggle_slug' => 'carousel', 503 563 'computed_affects' => array( 504 '__ posts',564 '__fhcallback', 505 565 ), 506 566 ), … … 531 591 'description' => esc_html__( 'When enabled, a you can drag the carousel using touch on touch devices.', 'et_builder' ), 532 592 ), 533 'auto_width' => array(593 /*'auto_width' => array( 534 594 'label' => esc_html__( 'Auto Width', 'et_builder' ), 535 595 'type' => 'yes_no_button', … … 543 603 'toggle_slug' => 'carousel', 544 604 'description' => esc_html__( 'When enabled, a carousel items will be in dynamic width.', 'et_builder' ), 545 ), 605 ),*/ 546 606 'rewind' => array( 547 607 'label' => esc_html__( 'Rewind', 'et_builder' ), … … 606 666 'toggle_slug' => 'navigation', 607 667 ), 608 '__ posts' => array(668 '__fhcallback' => array( 609 669 'type' => 'computed', 610 670 'computed_callback' => array( 'ET_Builder_Module_FH_Divi_Post_Carousel', 'get_blog_posts' ), 611 671 'computed_depends_on' => array( 612 //'include_categories',672 'tax_query', 613 673 'orderby', 614 674 'content_source', … … 618 678 ), 619 679 ); 680 681 foreach($fieldPart2 as $key => $tax) { 682 $fields[$key] = $tax; 683 } 620 684 621 685 return $fields; … … 646 710 'post_type' => 'post', 647 711 'posts_number' => '', 648 /*'include_categories' => '',*/649 712 'orderby' => '', 650 713 'content_source' => '', … … 653 716 ); 654 717 655 $args = wp_parse_args( $args, $defaults ); 718 $args = wp_parse_args( $args, $defaults ); 656 719 657 720 $query_args = array( … … 664 727 } 665 728 666 if ( '' !== $args[' include_categories'] ) {667 $query_args[' cat'] = $args['include_categories'];729 if ( '' !== $args['tax_query'] ) { 730 $query_args['tax_query'] = $args['tax_query']; 668 731 } 669 732 … … 812 875 $carousel_items_last_edited = $this->props['carousel_items_last_edited']; 813 876 $loop = $this->props['loop']; 877 $post_bg = $this->props['post_bg']; 814 878 $item_margin = $this->props['item_margin']; 815 879 $mouse_drag = $this->props['mouse_drag']; 816 880 $touch_drag = $this->props['touch_drag']; 817 $auto_width = $this->props['auto_width'];881 /*$auto_width = $this->props['auto_width'];*/ 818 882 $rewind = $this->props['rewind']; 819 883 $slide_by = $this->props['slide_by']; … … 830 894 $background_blend = $this->props['background_blend']; 831 895 $posts_number = $this->props['posts_number']; 832 /*$include_categories = $this->props['include_categories'];*/ 896 $selected_tax = $this->props['include_taxonomy_'.$selected_post_type]; 897 $include_categories = $this->props['include_cat_'.$selected_tax]; 833 898 $show_more_button = $this->props['show_more_button']; 834 899 $more_text = $this->props['more_text']; … … 855 920 $hide_on_mobile_class = '';//self::HIDE_ON_MOBILE; 856 921 922 //print_r($include_categories); die; 923 857 924 // Applying backround-related style to slide item since advanced_option only targets module wrapper 858 925 if ( 'on' === $this->props['show_image'] && 'background' === $this->props['image_placement'] && 'off' === $parallax ) { … … 918 985 } 919 986 } 987 else { 988 if(empty($post_bg)) { 989 $post_bg = '#fff'; 990 } 991 if(!empty($post_bg)) { 992 echo '<style>.et_pb_fh_post_carousel .owl-carousel .et_pb_fh_carousel_item { background-color:'.$post_bg.' } </style>'; 993 } 994 } 920 995 921 996 $fullwidth = 'et_pb_fullwidth_carousel' === $render_slug ? 'on' : 'off'; … … 931 1006 $video_background = $this->video_background(); 932 1007 $parallax_image_background = $this->get_parallax_image_background(); 1008 1009 $tax_query = array(); 1010 1011 if(!empty($include_categories) && !empty($selected_tax)) { 1012 $include_categories = explode(',',$include_categories); 1013 $tax_query = array( 1014 array( 1015 'taxonomy' => $selected_tax, 1016 'field' => 'term_id', 1017 'terms' => $include_categories 1018 ) 1019 ); 1020 } 933 1021 934 1022 ob_start(); … … 938 1026 'post_type' => $selected_post_type, 939 1027 'posts_number' => $posts_number, 940 /*'include_categories' => $include_categories,*/1028 'tax_query' => $tax_query, 941 1029 'orderby' => $orderby, 942 1030 'content_source' => $content_source, … … 1074 1162 } 1075 1163 1164 //data-auto-width="'.$auto_width.'" 1165 1076 1166 $output = sprintf( 1077 1167 '<div%3$s class="%1$s"%7$s%8$s> 1078 1168 %5$s 1079 1169 %4$s 1080 <div class="et_pb_fh_post_carousels owl-carousel" data-autoplay="'.$autoplay.'" data-autoplaytimeout="'.$autoplay_time.'" data-hoverpause="'.$autoplay_hoverpause.'" data-items="'.$carousel_items.'" data-items-tablet="'.$carousel_items_tablet.'" data-items-phone="'.$carousel_items_phone.'" data-loop="'.$loop.'" data-margin="'.$item_margin.'" data-mouse-drag="'.$mouse_drag.'" data-touch-drag="'.$touch_drag.'" data- auto-width="'.$auto_width.'" data-rewind="'.$rewind.'" data-slide-by="'.$slide_by.'" data-dots-each="'.$dots_each.'" data-lazy-load="'.$lazy_load.'">1170 <div class="et_pb_fh_post_carousels owl-carousel" data-autoplay="'.$autoplay.'" data-autoplaytimeout="'.$autoplay_time.'" data-hoverpause="'.$autoplay_hoverpause.'" data-items="'.$carousel_items.'" data-items-tablet="'.$carousel_items_tablet.'" data-items-phone="'.$carousel_items_phone.'" data-loop="'.$loop.'" data-margin="'.$item_margin.'" data-mouse-drag="'.$mouse_drag.'" data-touch-drag="'.$touch_drag.'" data-rewind="'.$rewind.'" data-slide-by="'.$slide_by.'" data-dots-each="'.$dots_each.'" data-lazy-load="'.$lazy_load.'"> 1081 1171 %2$s 1082 1172 </div> <!-- .et_pb_fh_post_carousels --> -
post-carousel-for-dv-builder/trunk/postcarousel.php
r2132707 r2192699 5 5 Author: Faiyaz Vaid 6 6 Author URI: https://www.facebook.com/faiyaz.vaid 7 Version: 1. 07 Version: 1.1 8 8 Description: Post carousel for Divi builder with the support of custom post types and various carousel options. 9 9 Requires PHP: 5.6 -
post-carousel-for-dv-builder/trunk/readme.txt
r2191162 r2192699 5 5 Requires at least: 4.5 6 6 Tested up to: 5.3 7 Stable tag: 1. 07 Stable tag: 1.1 8 8 Requires PHP: 5.6 9 9 License: GPLv2 or later … … 14 14 == Description == 15 15 16 Post Carousel for D Vis fully compatible with Divi theme only. It is a very useful plugin to show your posts or custom post in a awesome sliding manner. It has various options so that you can customize it in your own way.16 Post Carousel for Divi is fully compatible with Divi theme only. It is a very useful plugin to show your posts or custom post in a awesome sliding manner. It has various options so that you can customize it in your own way. 17 17 18 18 **Features** … … 98 98 If you like this plugin, please give me 5 stars to encourage for future improvement. 99 99 100 == Changelog == 101 102 = 1.1 = 103 * Category selection has been added 104 * Auto width has been removed as it was not usable 105 * Post background color option has been added 106 107 = 1.0 = 108 * Intial version launch 100 109 101 110 == Screenshots ==
Note: See TracChangeset
for help on using the changeset viewer.