Sort course category carousel using custom order or ID

Home Forums Legacy Support Support queries Setup issues Sort course category carousel using custom order or ID

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #262615
    Makarand Mane
    Spectator
    Hi in course category carousel I want to sort cat using ID or custom order provided in admin. It only sort with name. https://prnt.sc/snfmva
    #263126
    Makarand Mane
    Spectator
    Hi Any update
    #263509
    Jackson
    Blocked
    Hello, Dear friend, sorry for late reply, But there is no option to sort courses by id or order in course category carousel, only there is an option to include terms by slug if you want to exclude some items from this carousel then include those items which you want to show, Refer: https://prnt.sc/sp6bv9 Thanks,
    #263706
    Makarand Mane
    Spectator
    HI Jackson I dont need to exclude. I need to re-order it, way my client want. Tell me where code of this elementor block is located
    #264082
    Jackson
    Blocked
    Hello @makarand, Sorry friend , This is Not available , Thanks,
    #264083
    Makarand Mane
    Spectator
    Hello @Jackson Just tell me where is code of this elementor block is located. I will change myself
    #264292
    Anshuman Sahu
    Keymaster
    Its in \wp-content\plugins\vibe-customtypes\metaboxes\library\vibe-editor.php file taxnomy_carousel function . Note that changing the code directly into core plugin files is not recommended , you will loose all these changes after update and we wont be able to help you with it .
    #264304
    Makarand Mane
    Spectator
    Hi Alex
    1. Working with WPLMS since 2014, so well aware about updates
    2. I am going to modify it using hooks or I will override this function from child theme.
    3. Can u plz tell me in which function, taxnomy_carousel is called? I checked plugin and theme but didn't found this is used anywhere. I am using elementor builder not vibe builder, so it this same function used by elementor also?
    4. I saw this shortcode add_shortcode('v_taxonomy_carousel', array($this,'taxonomy_carousel')); But taxonomy_carousel is not used anywhere. Call back for this shortcode is taxonomy_carousel and declared function is taxnomy_carousel. Both are different in spelling.
    Updates: Added my Finding and reply. check below
    #264323
    Makarand Mane
    Spectator
    Hi Alex, Addition to last reply,
    1. You already have parameter declared for shortcode called orderby...
    2. For elementor you added control Order by but options are wrong ('Decending', 'Ascending') Which should be same as required by shortcode  Like 'Alphabetical', 'description'& ,'meta_value_num'='Custom Order' & you dont have control named Order for elementor widget, with option  ('Decending', 'Ascending') .
    3. If you add right control & so it work without any hassle. As shortcode already accepts parameter, meta_value_num & can sort by custom order
    4. I think its mistake in your code & you should fix in next update
    File vibe-editor.php line no 3106
    $v_modules['taxonomy_carousel'] = array(
            'name' => __('Course Category Carousel', 'vibe-customtypes'),
            'options' => array(
                ....................................
                 'orderby' => array(
                    'title' => __('Show Direction arrows', 'vibe-customtypes'),
                    'type' => 'select',
                    'type' => 'select',
                    'options' => array('name'=>__('Alphabetical', 'vibe-customtypes'),'description'=>__('Description', 'vibe-customtypes'),'meta_value_num'=>__('Custom Order','vibe-customtypes')),
                    'std' => 1
                ), 
    
    
    vibe-courseCarousel.php Line no 85
           $this->add_control(
                'orderby',
                [
                    'label' => __('OrderBy', 'vibe-customtypes'),
                    'type' => \Elementor\Controls_Manager::SELECT,
                    'default' => 'rated',
                    'options' => array(
                        'DESC' => 'Decending',
                        'ASC' => 'Ascending'
                    ),
                ]
            );
    
    As you can see above, default parameter & options doesnt match at all.  On line no 502, Why you are forcefully replacing orderby & order value?
    if(!empty($atts['orderby'])){
    
    $args['orderby']='name';$args['order']=$atts['orderby'];
    
    }
    #264808
    Anshuman Sahu
    Keymaster
    You are right , this was done by a team member who integrated the elementor with theme . Adding to issue  log : https://trello.com/c/JrNeeThB
    #264863
    Makarand Mane
    Spectator
    Looks like your elementor developer was in too hurry to finish it :) Here is my patch https://pastebin.com/FZZuLyeN
    From 680925dc9c3147f052a574ad630b40d2f62fc56d Mon Sep 17 00:00:00 2001
    From: Makarand Mane <[email protected]>
    Date: Sun, 31 May 2020 01:23:06 +0530
    Subject: [PATCH] Fix sort category by custom order. Added new dropdown for
     orderby with correct options. Corrected code in callback function
    
    ---
     includes/elementor/widgets/vibe-courseCarousel.php | 12 +++++++++++-
     metaboxes/library/vibe-editor.php                  |  5 ++++-
     2 files changed, 15 insertions(+), 2 deletions(-)
    
    diff --git a/includes/elementor/widgets/vibe-courseCarousel.php b/includes/elementor/widgets/vibe-courseCarousel.php
    index 23a0dd3..3c7ec48 100644
    --- a/includes/elementor/widgets/vibe-courseCarousel.php
    +++ b/includes/elementor/widgets/vibe-courseCarousel.php
    @@ -85,7 +85,17 @@ if ( ! defined( 'ABSPATH' ) ) {
                [
                    'label' => __('OrderBy', 'vibe-customtypes'),
                    'type' => \Elementor\Controls_Manager::SELECT,
    -               'default' => 'rated',
    +               'default' => 'name',
    +               'options' => array('name'=>__('Alphabetical', 'vibe-customtypes'),'description'=>__('Description', 'vibe-customtypes'),'meta_value_num'=>__('Custom Order','vibe-customtypes')),
    +           ]
    +       );
    +
    +       $this->add_control(
    +           'order',
    +           [
    +               'label' => __('Order', 'vibe-customtypes'),
    +               'type' => \Elementor\Controls_Manager::SELECT,
    +               'default' => 'ASC',
                    'options' => array(
                        'DESC' => 'Decending',
                        'ASC' => 'Ascending'
    diff --git a/metaboxes/library/vibe-editor.php b/metaboxes/library/vibe-editor.php
    index 1d9af86..c0df8fa 100644
    --- a/metaboxes/library/vibe-editor.php
    +++ b/metaboxes/library/vibe-editor.php
    @@ -500,7 +500,10 @@ function custom_post_carousel($atts, $content = null) {
     
                 }
                 if(!empty($atts['orderby'])){
    -              $args['orderby']='name';$args['order']=$atts['orderby'];
    +              $args['order']= $atts['order'];
    +             $args['orderby']=$atts['orderby'];
    +             if( $atts['orderby'] == 'meta_value_num')
    +                 $args['meta_key']= 'course_cat_order';
                 }
                 if(empty($args['include'])){unset($args['include']);}
                 if(empty($args['orderby'])){unset($args['orderby']);unset($args['order']);unset($args['meta_key']);}
    -- 
    2.19.1.windows.1
    
    
    #265140
    Anshuman Sahu
    Keymaster
    Thank you for reporting these .Will check carefully for other mistakes and these commits and update the plugin code .
    #271045
    Makarand Mane
    Spectator
    Is this code added in new update?
    #271560
    Anshuman Sahu
    Keymaster
    Well the update has not rolled out yet .  
    #281166
    mgozitn
    Participant
    This reply has been marked as private.
Viewing 15 posts - 1 through 15 (of 16 total)
  • The topic ‘Sort course category carousel using custom order or ID’ is closed to new replies.