Hi!
I’m trying to sort some items alphabetically. I’m using the Blog post element and selected the items that should be used in the list. I’m using a plugin to add categories to pages in order to show them in a list.
I’ve tried different pieces of code mentioned in other threads, such as
add_filter('avia_blog_post_query','avia_modify_blog_post_query');
function avia_modify_blog_post_query( $query)
{
$query['orderby'] = 'name';
$query['order'] = 'ASC';
return $query;
}
but that hasn’t helped me so far. Can you help me? Extra info is in the private section.
Thanks!
Hey Daniel,
Since you’re using grid, try using this code instead:
add_filter('avia_post_slide_query','avia_modify_blog_post_query');
function avia_modify_blog_post_query( $query)
{
$query['orderby'] = 'name';
$query['order'] = 'ASC';
return $query;
}
Best regards,
Nikko
Hi Nikko,
Awesome, that works! Is there also a way I can influence the position of the posts? It’s now done alphabetically, but can I put in some priority, ie. influence which posts are placed on top, without changing the names?
Hi Daniel,
I’m not really sure, how to do that with the custom code, here are some references you can check for orderby: https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters
Maybe you can use this plugin to re-arrange it: https://wordpress.org/plugins/post-types-order/
Best regards,
Nikko
Hi Nikko,
I’ll have a look at those links. You may close the issue, thanks for the help!
Regards, Daniel
Hi Daniel,
Glad that we could help :)
Thanks for using Enfold and have a great day!
Best regards,
Nikkoa