Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 1,081 through 1,095 (of 3,958 total)
  • Author
    Posts
  • Anh TranAnh Tran
    Keymaster

    Hi Jonathan,

    Please see this docs: https://docs.metabox.io/extensions/meta-box-group/#outputing-group-in-a-page-builder

    in reply to: MB Relationships display only post name #14826
    Anh TranAnh Tran
    Keymaster

    Hi @easy,

    The working code here: https://pastebin.com/qKA2uYWL

    There are 2 notes:

    • I added the code to get the current post ID
    • Query args are set for the current post type, so the param should be in the from part instead of to

    I also optimize the query a little bit.

    I'm checking the bug with reordering. Thanks for your feedback.

    Updated: I've checked the reorder bug and it seems to be the browser cache. Pressing Ctrl-F5 to reload the page without cache will fix this.

    in reply to: OSM Map not displaying correctly in back end. #14825
    Anh TranAnh Tran
    Keymaster

    Hi,

    I also noticed the issue that OSM not fully loaded when page loads. I made a fix for that on Github here and here, please try it.

    In your case, I see you specified the address field incorrectly. Please set the field ID, not field name.

    in reply to: Using MB to create a restaurant menu builder #14824
    Anh TranAnh Tran
    Keymaster

    Hi Neil,

    This is an interesting case.

    I think you probably don't need a CPT for Menu. Since each location has a specific menu, a CPT Menu probably serves nothing.

    If I do this, I probably will set CPTs this way:

    • Menu items: each menu item has a default price
    • Locations: each location will has a cloneable group of menu items, like this:
      • Menu item: a post field (for selecting menu items from the list)
      • Custom price: a text field (if that location has a different price for that menu item)

    If some locations have unique menu items, they should be added as a new posts under Menu items first. Then users can select from the list when edit a Location.

    in reply to: Displaying Time Data #14823
    Anh TranAnh Tran
    Keymaster

    Hi Neil,

    You can convert the format using PHP date() function. Assuming your time has format "04:20 PM", and you want to convert to "16:20", here is the code:

    $time = rwmb_meta( 'field_id' ); // 04:20 PM
    echo date( 'H:i', strtotime( $time ) ); // 16:20

    See more answers here.

    in reply to: Input type image_advanced vs image #14822
    Anh TranAnh Tran
    Keymaster

    Yes, we have resolved this problem and the fix was added in the 4.18.2 version.

    in reply to: Choose File in custom table #14811
    Anh TranAnh Tran
    Keymaster

    Hi Dave, sorry for the delay. I couldn't find anything wrong with the code. Can you send me a temporary admin account to take a look into that closer?

    in reply to: Prefix in missing in the builder? #14802
    Anh TranAnh Tran
    Keymaster

    Prefix is just an option and sometimes, it confuses people. So in the MB Builder, we don't include it. You can add the prefix manually in the ID fields if you want.

    in reply to: Open Street Map: View all post of one cpt #14783
    Anh TranAnh Tran
    Keymaster

    Sorry for the delay, here you are.

    in reply to: MB Relationships display only post name #14778
    Anh TranAnh Tran
    Keymaster

    Hmm, looks like the disabled elements won't be submitted when submitting the form.

    I think both issues (disable selection and limit the query) can be done like this:

    • Make an extra query to get the current selected options (do it by making a SQL query directly to the database). With this, you get the IDs of the connected posts.
    • Set the post__in for query_args in the relationship meta box. So the query only get the selected items.
    in reply to: Duplicate posts returned from relationship query #14764
    Anh TranAnh Tran
    Keymaster

    Hi, it's a bug when running the SQL. I've just fixed it here. Can you try it?

    in reply to: Choose File in custom table #14761
    Anh TranAnh Tran
    Keymaster

    If the field is updating, that means it still saves values in the post meta. Can you verify that?

    And did you put all the fields in one meta box?

    in reply to: MB Relationships display only post name #14759
    Anh TranAnh Tran
    Keymaster

    You can set query_args parameter for from and to to limit the query. If you know the IDs of selected items, you can do this:

    MB_Relationships_API::register( [
        'id'   => 'posts_to_pages',
        'from' => [
            'post_types' => 'post',
            'query_args' => [ 'post__in' => [1,2,3], 'posts_per_page' => 10 ],
        ],
        'to'   => 'page',
    ] );
    in reply to: Choose File in custom table #14758
    Anh TranAnh Tran
    Keymaster

    I don't see anything wrong here. Do you see other fields saved in the database?

    in reply to: MB Custom Table and wp_insert_post #14756
    Anh TranAnh Tran
    Keymaster

    Hi Will,

    For WP_Query, the plugin doesn't integrate with it. You need to perform an extra query to get the posts you want, then use the returned ID to create your own WP_Query.

    global $wpdb;
    $ids = $wpdb->get_col( "SELECT ID FROM your_table WHERE field1='value1' OR field2='value2'" );
    
    $query = new WP_Query( [
        'post_type' => 'post',
        'post__in'  => $id,
    ] );
Viewing 15 posts - 1,081 through 1,095 (of 3,958 total)