Tagged: alphabetically, blog posts element, custom taxonomy, filter
-
AuthorPosts
-
June 1, 2023 at 6:51 pm #1409298
Dear Krisies,
I’m using the blog posts element to display blog entries taged with “A”, “B”, “C”… etc. The filter allows to display only by date. Are there any options or filters to display the entries alphabetically in special cases? I need this filter only for entries from custom taxonomy. All other posts must be displayed by date.Best regards
AnneJune 1, 2023 at 8:33 pm #1409319you can find on docu some info on how to influence the orderby options:
https://kriesi.at/documentation/enfold/blog-post/#toggle-id-25But: this only allows you to orderby Title ( alphabetically).
what do you mean by tags in your description – you set some post tags on post edit – then we had to find a different solution on that.____________
if you use that : “How to add an order/orderby option to the blog/post slider/portfolio/masonry grid element”
in your child-theme functions.phpif(!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); 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_elements','avia_custom_query_options', 10, 1); 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; } add_filter('avf_template_builder_shortcode_meta', 'avia_custom_query_add_query_params_to_config', 10, 4); }
June 2, 2023 at 12:10 pm #1409385Thank you very much, it works fine!
I really like working with Enfold.
Best regards
AnneJune 2, 2023 at 11:17 pm #1409449Hi,
Glad Guenni007 could help, thank you Guenni007, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.Best regards,
Mike -
AuthorPosts
- The topic ‘display entries from custom taxonomy alphabetically in blog posts element’ is closed to new replies.