Hello everyone,
I want to create a select field in a custom module with a query via WP_Query and custom fields, and a sorting by menu items:
'items_list' => array(
'type' => 'select',
'label' => __( 'Items', 'fl-builder' ),
'default' => '',
'options' => getItems(),
),
Here is the query:
$args = array(
'posts_per_page' => -1,
'post_type' => 'cpt_items',
'suppress_filters' => true,
'post_parent' => 0,
'fields' => "ids",
'orderby' => 'menu_order'
);
$items = new WP_Query($args);
Where or how do I have to store the query? In the FLBuilderModule class, the query does not give me the correct results, e.g. the sorting “menu_order” is ignored etc.
Is it generally possible to dynamically set the options for a select field in an “FLBuilder::register_module”?
Many Thanks