Order_by last name in custom table using query loop in Bricks Builder

Support Meta Box AIO Order_by last name in custom table using query loop in Bricks Builder

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #48528
    HelmsHelms
    Participant

    Hi,

    I've setup a CPT for staff saving data to custom table. I'm using the query loop in Bricks Builder, but I'm unable to order alphabetical by last name (meta key -> last_name). I've tried using the order-by -> order meta value = last_name, but it's not showing anything. I've read somewhere, and can't find where I read it, that it wasn't possible to do this because it's in a custom table. Is this true? If so, is there a workaround?

    Thanks.

    #48531
    PeterPeter
    Moderator

    Hello,

    In case of using Bricks Builder, please reach out to them if you have any issues with installation, configuration, compatibility, or usage.
    Refer to our support policy https://metabox.io/support/topic/support-policy/

    Thank you.

    #48533
    HelmsHelms
    Participant

    Hi,

    I don't have an issue with Bricks Builder and I'm not asking you for support on Bricks Builder for any issue with installation, configuration, compatibility, or usage (according to your own support policy). I'm just letting you know what I'm using since you will ask anyways. According to your own documentation Bricks Builder is listed as compatible builder plugin https://docs.metabox.io/compatibility/. On the Full Support tab on this page https://metabox.io/features/ doesn't really seem like unparalleled support and that you have our backs. I go to Bricks they say "ask MetaBox why", I go to MetaBox you guys say ask Bricks.

    I think my question was simple enough for you answer or provide some kind of useful feedback to help out one of your customers. If you aren't willing to do that, then kindly assign this ticket to someone else please.

    #48535
    PeterPeter
    Moderator

    Hello,

    Not related to Bricks but if you use the code to create the custom query and order posts by meta value, please try this one

    $args = [
        'post_type'      => 'your_post_type', // e.g., 'post', 'page', or custom post type
        'posts_per_page' => -1,
        'meta_key'       => 'title',          // your custom field key
        'orderby'        => 'meta_value',     // or 'meta_value_num' for numeric values
        'order'          => 'ASC',            // or 'DESC'
    ];
    
    $query = new WP_Query( $args );
    

    Refer to the WordPress documentation https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters

    Let me know how it goes.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.