Plugin Directory

Changeset 2192699


Ignore:
Timestamp:
11/14/2019 11:46:13 AM (5 years ago)
Author:
vaidfaiyaz
Message:

Version 1.1 Launch

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  
    1818                    'toggles' => array(
    1919                        'main_content'   => esc_html__( 'Content', 'et_builder' ),
     20                        'post_background'   => esc_html__( 'Post Background', 'et_builder' ),
    2021                        'elements'       => esc_html__( 'Elements', 'et_builder' ),
    2122                        'featured_image' => esc_html__( 'Featured Image', 'et_builder' ),
     
    214215            $post_types = get_post_types( array('public' => true) );
    215216            $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            }
    216273            $fields = array(
    217274                'selected_post_type' => array(
     
    222279                    'toggle_slug'       => 'main_content',
    223280                    'computed_affects'  => array(
    224                         '__posts',
     281                        '__fhcallback',
    225282                    ),
    226283                ),
     
    236293                    'default'          => 10,
    237294                    '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(
    254306                'orderby' => array(
    255307                    'label'             => esc_html__( 'Order By', 'et_builder' ),
     
    266318                    'description'       => esc_html__( 'Here you can adjust the order in which posts are displayed.', 'et_builder' ),
    267319                    'computed_affects'  => array(
    268                         '__posts',
     320                        '__fhcallback',
    269321                    ),
    270322                    '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' ),
    271331                ),
    272332                'show_arrows'         => array(
     
    335395                    'toggle_slug'       => 'main_content',
    336396                    'computed_affects'  => array(
    337                         '__posts',
     397                        '__fhcallback',
    338398                    ),
    339399                ),
     
    351411                    'toggle_slug'       => 'main_content',
    352412                    'computed_affects'  => array(
    353                         '__posts',
     413                        '__fhcallback',
    354414                    ),
    355415                ),
     
    363423                    'toggle_slug'       => 'main_content',
    364424                    'computed_affects'  => array(
    365                         '__posts',
     425                        '__fhcallback',
    366426                    ),
    367427                ),
     
    441501                    'toggle_slug'       => 'carousel',
    442502                    'computed_affects'  => array(
    443                         '__posts',
     503                        '__fhcallback',
    444504                    ),
    445505                ),
     
    469529                    'toggle_slug'       => 'carousel',
    470530                    'computed_affects'  => array(
    471                         '__posts',
     531                        '__fhcallback',
    472532                    ),
    473533                    'mobile_options'  => true,
     
    502562                    'toggle_slug'       => 'carousel',
    503563                    'computed_affects'  => array(
    504                         '__posts',
     564                        '__fhcallback',
    505565                    ),
    506566                ),
     
    531591                    'description'     => esc_html__( 'When enabled, a you can drag the carousel using touch on touch devices.', 'et_builder' ),
    532592                ),
    533                 'auto_width'      => array(
     593                /*'auto_width'      => array(
    534594                    'label'           => esc_html__( 'Auto Width', 'et_builder' ),
    535595                    'type'            => 'yes_no_button',
     
    543603                    'toggle_slug'     => 'carousel',
    544604                    'description'     => esc_html__( 'When enabled, a carousel items will be in dynamic width.', 'et_builder' ),
    545                 ),
     605                ),*/
    546606                'rewind'      => array(
    547607                    'label'           => esc_html__( 'Rewind', 'et_builder' ),
     
    606666                    'toggle_slug'  => 'navigation',
    607667                ),
    608                 '__posts' => array(
     668                '__fhcallback' => array(
    609669                    'type'                => 'computed',
    610670                    'computed_callback'   => array( 'ET_Builder_Module_FH_Divi_Post_Carousel', 'get_blog_posts' ),
    611671                    'computed_depends_on' => array(
    612                         //'include_categories',
     672                        'tax_query',
    613673                        'orderby',
    614674                        'content_source',
     
    618678                ),
    619679            );
     680
     681            foreach($fieldPart2 as $key => $tax) {
     682                $fields[$key] = $tax;
     683            }
    620684
    621685            return $fields;
     
    646710                'post_type'          => 'post',
    647711                'posts_number'       => '',
    648                 /*'include_categories' => '',*/
    649712                'orderby'            => '',
    650713                'content_source'     => '',
     
    653716            );
    654717
    655             $args = wp_parse_args( $args, $defaults );
     718            $args = wp_parse_args( $args, $defaults );         
    656719
    657720            $query_args = array(
     
    664727            }
    665728
    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'];
    668731            }
    669732
     
    812875            $carousel_items_last_edited      = $this->props['carousel_items_last_edited'];
    813876            $loop                            = $this->props['loop'];
     877            $post_bg                         = $this->props['post_bg'];
    814878            $item_margin                     = $this->props['item_margin'];
    815879            $mouse_drag                      = $this->props['mouse_drag'];
    816880            $touch_drag                      = $this->props['touch_drag'];
    817             $auto_width                      = $this->props['auto_width'];
     881            /*$auto_width                      = $this->props['auto_width'];*/
    818882            $rewind                          = $this->props['rewind'];
    819883            $slide_by                        = $this->props['slide_by'];
     
    830894            $background_blend                = $this->props['background_blend'];
    831895            $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];
    833898            $show_more_button                = $this->props['show_more_button'];
    834899            $more_text                       = $this->props['more_text'];
     
    855920            $hide_on_mobile_class            = '';//self::HIDE_ON_MOBILE;
    856921
     922            //print_r($include_categories); die;
     923
    857924            // Applying backround-related style to slide item since advanced_option only targets module wrapper
    858925            if ( 'on' === $this->props['show_image'] && 'background' === $this->props['image_placement'] && 'off' === $parallax ) {
     
    918985                }
    919986            }
     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            }
    920995
    921996            $fullwidth = 'et_pb_fullwidth_carousel' === $render_slug ? 'on' : 'off';
     
    9311006            $video_background = $this->video_background();
    9321007            $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            }
    9331021
    9341022            ob_start();
     
    9381026                'post_type'          => $selected_post_type,
    9391027                'posts_number'       => $posts_number,
    940                 /*'include_categories' => $include_categories,*/
     1028                'tax_query'          => $tax_query,
    9411029                'orderby'            => $orderby,
    9421030                'content_source'     => $content_source,
     
    10741162            }
    10751163
     1164            //data-auto-width="'.$auto_width.'"
     1165
    10761166            $output = sprintf(
    10771167                '<div%3$s class="%1$s"%7$s%8$s>
    10781168                    %5$s
    10791169                    %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.'">
    10811171                        %2$s
    10821172                    </div> <!-- .et_pb_fh_post_carousels -->
  • post-carousel-for-dv-builder/trunk/postcarousel.php

    r2132707 r2192699  
    55Author:       Faiyaz Vaid
    66Author URI:   https://www.facebook.com/faiyaz.vaid
    7 Version:      1.0
     7Version:      1.1
    88Description:  Post carousel for Divi builder with the support of custom post types and various carousel options.
    99Requires PHP: 5.6
  • post-carousel-for-dv-builder/trunk/readme.txt

    r2191162 r2192699  
    55Requires at least:  4.5
    66Tested up to:       5.3
    7 Stable tag:         1.0
     7Stable tag:         1.1
    88Requires PHP:       5.6
    99License:            GPLv2 or later
     
    1414== Description ==
    1515
    16 Post Carousel for DV 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.
     16Post 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.
    1717
    1818**Features**
     
    9898If you like this plugin, please give me 5 stars to encourage for future improvement.
    9999
     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
    100109
    101110== Screenshots ==
Note: See TracChangeset for help on using the changeset viewer.