Support

Account

Home Forums ACF PRO Custom loop in ACF block Reply To: Custom loop in ACF block

  • Hey @anybodesign

    You should able to do that via get_posts() too.

    The most problem you don’t use the proper order value for that.
    I think you want to change the ‘order’ like this:

    $posts = get_posts([
    	'post_type'		=> 'product',
    	...
    	'meta_key'      => 'your_date_field',
      	'orderby'       => 'meta_value_num',
    ]);

    The key is the meta_value_num when you order by number / date type of fields