-
AuthorPosts
-
June 4, 2024 at 9:30 pm #1448251
Hi,
Just looking to change the display order o these posts, I don’t see an options to do so.I have changed the publish dates and the order they are listed in wp-admin.
Thank you
June 5, 2024 at 6:11 am #1448396Hey finchkelsey,
Thank you for the inquiry.
I have changed the publish dates and the order they are listed in wp-admin.
That is one way to do it. Another option is to use a plugin. Please check the link below:
// https://wordpress.org/plugins/post-types-order/
However, please note that the plugin could conflict with the breadcrumb and post navigation.
Best regards,
IsmaelJune 5, 2024 at 7:02 pm #1448488Hi, that’s not a great solution then is it.
Why does this not work,
//sort posts by date
add_filter(‘avia_blog_post_query’, ‘avia_modify_post_grid_query_desc’);
function avia_modify_post_grid_query_desc( $query ) {
$query[‘orderby’] = ‘date’;
$query[‘order’] = ‘DESC’;
return $query;
}I would like to order our posts in wp-admin by newest, not alphabetical, this should be simple no?
June 6, 2024 at 6:04 am #1448517Hi,
Thank you for the update.
By default, the posts should be sorted by date. If you want to adjust the order for the grid layout, try to replace avia_blog_post_query with the avia_post_slide_query filter.
add_filter('avia_post_slide_query', 'avia_post_slide_query_mod'); function avia_post_slide_query_mod($query) { $query['orderby'] = 'date'; $query['order'] = 'DESC'; return $query; }
Best regards,
IsmaelJune 7, 2024 at 4:39 pm #1448617This worked, thanks
//sort wp-recipe posts by date
function wpse_81939_post_types_admin_order( $wp_query ) {
if (is_admin()) {// Get the post type from the query
$post_type = $wp_query->query[‘post_type’];if ( $post_type == ‘posttypehere’) {
$wp_query->set(‘orderby’, ‘date’);
$wp_query->set(‘order’, ‘DESC’);
}
}
}
add_filter(‘pre_get_posts’, ‘wpse_81939_post_types_admin_order’);- This reply was modified 5 months, 2 weeks ago by finchkelsey.
June 9, 2024 at 7:18 pm #1448731Hi,
Glad to hear that you have this sorted out, 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 ‘Change display order blog posts grid’ is closed to new replies.