Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #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

    #1448396

    Hey 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,
    Ismael

    #1448488

    Hi, 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?

    #1448517

    Hi,

    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,
    Ismael

    #1448617

    This 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 6 months, 2 weeks ago by finchkelsey.
    #1448731

    Hi,
    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

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Change display order blog posts grid’ is closed to new replies.