Support

Account

Home Forums ACF PRO how to sort certain field selection

Helping

how to sort certain field selection

  • Hello
    I’ve a CPT with some entries – one of the ACF fields allows me to set the entry to e.g. “featured” – out of may 40 entries I’ve selected 4 as “featured” and show those in a slider – everything works beautifully – no the big question, I need to have a way to put those 4 entries in a specific order – what would be best way for me to do this – has anyone done something like this and share the solution.

    Your input is very much appreciated.

  • Since you’re setting them as featured when editing the post, I would also include support for “Page Attributes” in the setting for the CPT and then set the order using the built in order field. Then I’d use this field for to order the posts in the query that gets the featured posts

    
    //.....
      'orderby' => array('menu_order' => 'ASC');
    //.....
    

    or

    
    //.....
      'orderby' => 'menu_order',
      'order' => 'ASC'
    //.....
    

    depending on how you write your WP_Query args

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘how to sort certain field selection’ is closed to new replies.