Viewing 19 posts - 1 through 19 (of 19 total)
  • Author
    Posts
  • #758840

    Hi Team,

    is there a way to sort Magazine Items in alphabetical order?
    Maybe function.php?

    Thank you and regards
    Mike

    #758856

    put this to functions.php of your child-theme:

    
    if(!function_exists('avia_custom_query_extension'))
    {
        function avia_custom_query_extension($query, $params)
        {
            global $avia_config;
            if(!empty($avia_config['avia_custom_query_options']['order']))
            {
                $query['order'] = $avia_config['avia_custom_query_options']['order'];
            }
    
            if(!empty($avia_config['avia_custom_query_options']['orderby']))
            {
                $query['orderby'] = $avia_config['avia_custom_query_options']['orderby'];
            }
    
            unset($avia_config['avia_custom_query_options']);
    
            return $query;
        }
    
        add_filter('avia_masonry_entries_query', 'avia_custom_query_extension', 10, 2);
        add_filter('avia_post_grid_query', 'avia_custom_query_extension', 10, 2);
        add_filter('avia_post_slide_query', 'avia_custom_query_extension', 10, 2);
        add_filter('avia_blog_post_query', 'avia_custom_query_extension', 10, 2);
        add_filter('avf_magazine_entries_query', 'avia_custom_query_extension', 10, 2);
    
        add_filter('avf_template_builder_shortcode_elements','avia_custom_query_options', 10, 1);
        function avia_custom_query_options($elements)
        {
            $allowed_elements = array('av_blog','av_masonry_entries','av_postslider','av_portfolio','av_magazine');
    
            if(isset($_POST['params']['allowed']) && in_array($_POST['params']['allowed'], $allowed_elements))
            {
                $elements[] = array(
                    "name" => __("Custom Query Orderby",'avia_framework' ),
                    "desc" => __("Set a custom query orderby value",'avia_framework' ),
                    "id"   => "orderby",
                    "type"  => "select",
                    "std"   => "",
                    "subtype" => array(
                        __('Default Order',  'avia_framework' ) =>'',
                        __('Title',  'avia_framework' ) =>'title',
                        __('Random',  'avia_framework' ) =>'rand',
                        __('Date',  'avia_framework' ) =>'date',
                        __('Author',  'avia_framework' ) =>'author',
                        __('Name (Post Slug)',  'avia_framework' ) =>'name',
                        __('Modified',  'avia_framework' ) =>'modified',
                        __('Comment Count',  'avia_framework' ) =>'comment_count',
                        __('Page Order',  'avia_framework' ) =>'menu_order')
                );
    
                $elements[] = array(
                    "name" => __("Custom Query Order",'avia_framework' ),
                    "desc" => __("Set a custom query order",'avia_framework' ),
                    "id"   => "order",
                    "type"  => "select",
                    "std"   => "",
                    "subtype" => array(
                        __('Default Order',  'avia_framework' ) =>'',
                        __('Ascending Order',  'avia_framework' ) =>'ASC',
                        __('Descending Order',  'avia_framework' ) =>'DESC'));
            }
    
            return $elements;
        }
    
        add_filter('avf_template_builder_shortcode_meta', 'avia_custom_query_add_query_params_to_config', 10, 4);
        function avia_custom_query_add_query_params_to_config($meta, $atts, $content, $shortcodename)
        {
            global $avia_config;
            if(empty($avia_config['avia_custom_query_options'])) $avia_config['avia_custom_query_options'] = array();
    
            if(!empty($atts['order']))
            {
                $avia_config['avia_custom_query_options']['order'] = $atts['order'];
            }
    
            if(!empty($atts['orderby']))
            {
                $avia_config['avia_custom_query_options']['orderby'] = $atts['orderby'];
            }
    
            return $meta;
        }
    }

    than you got extra options in the gallery dialogs

    #758860

    you can find here http://kriesi.at/documentation/enfold/code-snippets/ some code snippets to influence sort options globaly. But this above you can decide eachtime you generate a new alb element.

    #758864

    Thank you Guenni007, that’s it!
    Have a nice Weekend!

    Best regards
    Mike

    #758894

    by the way if you want a custom Sorting – use page order an the plugin “intuitive custom post order” –
    after activation you can sort the page order by drag & drop in page/post/portfolio listing of dashboard

    #759086

    Thank you Guenni007 :)

    #915732

    Is there a way to do this through quick CSS rather than editing the PHP file in a child theme?

    #915857

    Hi mitcsoftware,

    No, CSS is used for styling only.

    Best regards,
    Rikard

    #1034623

    Hi,
    I have used this reordering plugin but it does not allow to sort the post within the magazine. Any idea?

    On this page you can see my magazines. The order of the posts within the magazines do not change when using the plugin.

    2018-11-16_2104

    Thanks
    Marco

    #1035646

    Hi Marco,

    Can you give us temporary admin access to your website in the private content box below, so that we can have a closer look?

    Best regards,
    Victoria

    #1036033

    Hi Victoria,
    Sire

    Details attached below

    #1037343

    any luck with this ticket???

    #1037442

    Hi,

    Please try now, I have added a shorting option.

    Best regards,
    Basilis

    #1038788

    Hi Basilis,
    Thanks for your help. Can you please let me know where you have added this sorting option?

    Thanks,
    Marco

    #1040693

    Hi,


    @marcoabis81
    : I can’t find this filter in your functions.php file anywhere.

    // https://kriesi.at/support/topic/sort-magazine-items-in-alphabetical-order/#post-758856

    Where did you add it ?

    Best regards,
    Ismael

    #1043477

    Hi Ismael,
    I do not want to sort them by alphabetical order. I would like to have a custom order.

    Can you help?

    Regards,
    Marco

    #1044354

    Hi Marco,

    Unfortunately, it would require quite some time and customization of the theme to achieve this, so I am sorry to tell you that this is not covered by our support. However, if it’s really important for you to get this done, you can always hire a freelancer to do the job for you :)

    Best regards,
    Victoria

    #1107154

    The code snippet works great,but there is one issue. If you use the magazine element with ‘Display Tabs for each category selected above?’ – when you click on the tab on the front end, the tab will not be sorted as specified in the sorting options. How to fix that?

    #1108739

    Hi,

    @Genetics Ed: Please open a new thread for that and post the necessary details in the private field. We’ll close this thread now.

    Best regards,
    Ismael

Viewing 19 posts - 1 through 19 (of 19 total)
  • The topic ‘Sort Magazine Items in alphabetical order?’ is closed to new replies.