Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1079474

    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!

    #1080361

    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

    #1080371

    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?

    #1080399

    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

    #1080409

    Hi Nikko,

    I’ll have a look at those links. You may close the issue, thanks for the help!

    Regards, Daniel

    #1080440

    Hi Daniel,

    Glad that we could help :)
    Thanks for using Enfold and have a great day!

    Best regards,
    Nikkoa

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Sort blog posts alphabetically’ is closed to new replies.