I have recently tried to query posts in bricks builder in the order that I have reordered them with meta box's drag and drop feature. In short you will have to order by menu_order and then choose ascending.

image

The menu_order value is stored in your _posts table:

image

Understanding Meta Box's Reordering System

When you use Meta Box's drag-and-drop reordering feature (available in Meta Box AIO or the MB Admin Columns extension), it stores the order using WordPress's native menu_order column in the database. This is a built-in WordPress feature that assigns a numeric value to each post, with lower numbers appearing first.

How menu_order Works

Method 1: Query Loop in Bricks Builder (Recommended)

The most straightforward way to display reordered posts in Bricks Builder is through the Query Loop settings.

Step-by-Step Instructions

  1. Select Your Query Loop Element
    • Add or select a Query Loop, Posts, or any element that uses queries in Bricks
  2. Access Query Settings
    • Click on the element
    • Navigate to the Query settings panel
  3. Configure the Query
    • Set your post type (e.g., Portfolio, Team Members, etc.)
    • Scroll down to "Order By"
    • Select "Menu Order" from the dropdown
    • Set Order to "ASC" (Ascending)
  4. Save and Preview
    • Your posts should now appear in the exact order you set in Meta Box
image

Query Loop Settings Breakdown

Post Type: your_custom_post_type
Posts Per Page: -1 (for all posts)
Order By: Menu Order
Order: ASC

Method 2: Custom Query with Code

For more advanced use cases, you can create a custom query using PHP. This is useful when working with custom elements or dynamic data.

Using WP_Query

Add this code to your child theme's functions.php or a custom plugin:

function get_reordered_meta_box_posts() {
    $args = array(
        'post_type'      => 'your_post_type',
        'posts_per_page' => -1,
        'orderby'        => 'menu_order',
        'order'          => 'ASC'
    );
    
    $query = new WP_Query($args);
    
    return $query;
}

Registering a Custom Query in Bricks

To use this in Bricks Builder, you'll need to register a custom query:

add_filter('bricks/query/run', function($results, $query_obj) {
    if ($query_obj->object_type !== 'my_custom_query') {
        return $results;
    }
    
    $args = array(
        'post_type'      => 'your_post_type',
        'posts_per_page' => -1,
        'orderby'        => 'menu_order',
        'order'          => 'ASC'
    );
    
    $custom_query = new WP_Query($args);
    
    return $custom_query->posts;
}, 10, 2);

Then in Bricks:

  1. Select your Query Loop
  2. Query Type: Custom
  3. Custom Query ID: my_custom_query

Method 3: Using Bricks Query Filters

For dynamic filtering combined with menu order, use query filters:

add_filter('bricks/posts/query_vars', function($query_vars, $settings, $element_id) {
    // Target specific query loop by ID if needed
    if ($element_id === 'your_element_id') {
        $query_vars['orderby'] = 'menu_order';
        $query_vars['order'] = 'ASC';
    }
    
    return $query_vars;
}, 10, 3);

Troubleshooting Common Issues

Posts Not Displaying in Correct Order

Problem: Posts appear in date order instead of menu_order

Solution:

Checking menu_order Values

To verify your menu_order values in the database:

function check_menu_order() {
    $posts = get_posts(array(
        'post_type' => 'your_post_type',
        'posts_per_page' => -1,
        'orderby' => 'menu_order',
        'order' => 'ASC'
    ));
    
    foreach($posts as $post) {
        echo $post->post_title . ' - Menu Order: ' . $post->menu_order . '<br>';
    }
}

Multiple Sorting Parameters

If you need to sort by menu_order AND another field:

$args = array(
    'post_type'      => 'your_post_type',
    'posts_per_page' => -1,
    'orderby'        => array(
        'menu_order' => 'ASC',
        'date'       => 'DESC'
    )
);

Best Practices

1. Always Use menu_order for Manual Ordering

When you want full control over post order, menu_order is the WordPress standard and works seamlessly with Meta Box and Bricks Builder.

2. Set Posts Per Page to -1

When displaying a manually ordered collection, you typically want to show all items, not paginate them.

3. Use ASC Order

Ascending order ensures the first item you dragged to the top (menu_order = 0) appears first.

4. Clear Caches After Reordering

Bricks Builder caches queries for performance. After reordering in Meta Box, clear:

5. Test with Different Post Types

If you have multiple post types with reordering, ensure each query targets the correct post type.

Advanced Scenarios

Combining Taxonomies with menu_order

$args = array(
    'post_type'      => 'portfolio',
    'posts_per_page' => -1,
    'orderby'        => 'menu_order',
    'order'          => 'ASC',
    'tax_query'      => array(
        array(
            'taxonomy' => 'portfolio_category',
            'field'    => 'slug',
            'terms'    => 'web-design'
        )
    )
);

Dynamic Query Based on Current Post

For related posts using menu_order:

$current_category = wp_get_post_terms(get_the_ID(), 'your_taxonomy');

$args = array(
    'post_type'      => 'your_post_type',
    'posts_per_page' => 5,
    'orderby'        => 'menu_order',
    'order'          => 'ASC',
    'post__not_in'   => array(get_the_ID()),
    'tax_query'      => array(
        array(
            'taxonomy' => 'your_taxonomy',
            'terms'    => $current_category[0]->term_id
        )
    )
);

Meta Box Extensions for Reordering

MB Admin Columns

The MB Admin Columns extension provides the drag-and-drop interface for reordering. It automatically updates the menu_order field when you reorder posts.

Features:

Meta Box AIO

If you have Meta Box AIO (All-in-One), the reordering feature is already included.

Common Use Cases

1. Team Members

Display team members in organizational hierarchy rather than alphabetically or by date.

2. Portfolio Projects

Showcase your best work first, regardless of when it was published.

3. Service Listings

Prioritize featured services or arrange them by importance.

4. Product Showcases

Manually curate product display order for marketing campaigns.

5. Testimonials

Feature your strongest testimonials at the top.

Performance Considerations

Querying by menu_order is efficient because:

Conclusion

Querying reordered Meta Box posts in Bricks Builder is straightforward once you understand that Meta Box uses WordPress's native menu_order field. Simply set your Query Loop to order by "Menu Order" in ascending order, and your posts will display exactly as you arranged them.

The key takeaways:

With this knowledge, you have complete control over how your content displays, creating better user experiences and more effective websites with Bricks Builder and Meta Box.

Additional Resources


Keywords: Meta Box reorder, Bricks Builder query, menu_order WordPress, drag and drop posts, custom post order, Meta Box AIO, Bricks query loop, WordPress post ordering, Meta Box Bricks integration, custom post type ordering

The Solution

After notfying the Fluent Forms Team they realeased a hotfix withing 24hrs, which I greatly appreciate. Now the service is replaced with Google's API. You can obtain you API key at https://cloud.google.com/.

The Issue

If your form presents an error such as "Sorry! Please provide valid token for ipinfo.io in global settings" or "There is an error occurred in getting Country using geoplugin.net"

geoplugin.net error fluent forms
ipinfo.io error fluentforms

You need to go to your form's settings and disable the country based restriction. There is a possible conflict with your plugin.

Fluent form settings for country based restrictions

I have experienced this issue with 2 websites on different hosting environments.

Start your project today

Get in touch
Contact Form
crosschevron-left