Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 781 through 795 (of 3,958 total)
  • Author
    Posts
  • in reply to: Date fields allow to enter random numbers #16090
    Anh TranAnh Tran
    Keymaster

    Hi Mauro, you can disable the manual entry by setting 'readonly' => true.

    in reply to: ℹ️Integrate builder as a custom field #16089
    Anh TranAnh Tran
    Keymaster

    Hi Daniel,

    Could you please provide more info? Is this like creating a field to select saved templates from page builders?

    in reply to: Auto-populate field #16088
    Anh TranAnh Tran
    Keymaster

    Hi,

    Doesn't the std settings work? You can get the current post info (post ID is grabbed from $_GET) and put the post info in the std settings for the fields.

    in reply to: PHP warning when using clone w/ date formatting #16087
    Anh TranAnh Tran
    Keymaster

    Hi Ronald,

    Thanks for bug reporting. It's fixed here.

    Anh TranAnh Tran
    Keymaster

    Hi,

    Can you please give me more details on how you "enter them in our relevant WP plugins"? Do you set the license key programmatically?

    in reply to: Relationship field performance #16084
    Anh TranAnh Tran
    Keymaster

    Glad you like it.

    Do you want to remove an ajax query when users open a closed relationships field? I understand "closed relationship field" is a field that users already chose items for the relationship, right?

    Well, what if users want to change a selected item to something else? We still need to make ajax query to fetch other items for users to change.

    FYI, if a field already has some selected items, only once query is made when page loads (not via ajax). It makes sure the selected items is visible in the dropdown.

    If field has no selected items, no queries are created when page loads. Queries are created only via ajax.

    in reply to: Relationship field performance #16067
    Anh TranAnh Tran
    Keymaster

    Update: the ajax + pagination is enabled by default and works for terms and users. Please use the latest version on ajax-post branch on Github:

    https://github.com/wpmetabox/meta-box/tree/ajax-post

    Please try it before I release a new version.

    in reply to: Taxonomy Advanced field with ajax? #16066
    Anh TranAnh Tran
    Keymaster

    Hi Paul,

    This is done on Github (the ajax-post branch). Can you please try it before I release a new version:

    https://github.com/wpmetabox/meta-box/tree/ajax-post

    in reply to: Relationship field performance #16058
    Anh TranAnh Tran
    Keymaster

    Hi again,

    I've done the relationships for post. Please follow this guide to use it:

    • Download the latest dev version of MB Relationships on Github.
    • Download the latest dev version of Meta Box for ajax post on Github

    Now try it again and you'll see the ajax requests are sent when open the dropdown.

    If you want to customize the ajax request, in your code to register relationships, use this code:

    add_action( 'mb_relationships_init', function () {
        MB_Relationships_API::register( array(
            'id'   => 'users_to_posts',
            'from' => array(
                'object_type' => 'post',
                'meta_box'    => array(
                    'title' => 'Manages',
                ),
                'field' => array(
                    'ajax' => true, // Note this
                    'query_args' => array(
                        'posts_per_page' => 10, // This is for pagination in Ajax
                    ),
                    'js_options' => array(
                        'minimumInputLength' => 1, // Send ajax requests when users enter at least 1 character
                    ),
                ),
            ),
            'to'   => array(
                'object_type' => 'post',
                'post_type'   => 'page',
                'meta_box'    => array(
                    'title'         => 'Managed By',
                    'context'       => 'side',
                    'empty_message' => 'No users',
                ),
                'field' => array(
                    'ajax' => true, // Note this
                    'query_args' => array(
                        'posts_per_page' => 10, // This is for pagination in Ajax
                    ),
                ),
            ),
        ) );
    } );

    Some notes:

    • Now in the relationship, you'll have an extra field settings, which you can pass full settings array for the field. It's similar to post, taxonomy or user field.
    • Enable ajax for the dropdown by adding 'ajax' => true to the field
    • If you just want to query only some posts via ajax (not all of posts at once), you can set posts_per_page parameter.

    Currently, it works for posts only. I'll make it works for terms and users by tomorrow.

    Anh TranAnh Tran
    Keymaster

    @saint: no, the extensions just work. The integration will help pulling the data to output on the front end easier.

    I've marked this topic as super sticky. Guys, please upvote!

    in reply to: Tooltip issue #16053
    Anh TranAnh Tran
    Keymaster

    Hi Chris, thanks for your bug report. I'll check and fix it.

    Anh TranAnh Tran
    Keymaster

    Hi,

    I think you need to track the 'initial save' or 'update' with a custom option, like this:

    add_action( 'mb_settings_page_load', function() {
        $is_updated = get_option( 'your_custom_option' );
        if ( ! $is_updated ) {
            do_your_work();
            update_option( 'your_custom_option', 1 );
        }
    }, 20 );
    in reply to: Custom CSS class on meta box #16051
    Anh TranAnh Tran
    Keymaster

    Hi Ryan,

    It's not a bug. It's different implementations by WordPress in different areas. I think I'll add an extra param for the meta box for you to add custom CSS class easier. Please wait.

    in reply to: Relationship field performance #16050
    Anh TranAnh Tran
    Keymaster

    Hi,

    I almost finish it. You can track the progress here: https://github.com/wpmetabox/meta-box/commits/ajax-post.

    What I've done so far:

    • Make it possible to use ajax for post field (which is used in relationships plugin) by adding 'ajax' => true to the field.
    • Make pagination works in case you don't want to request all posts at once (via posts_per_page param in the query_args)
    • Cache the ajax requests

    I'm working on clone. If everything goes well, I can give you an example by the end of today.

    Anh TranAnh Tran
    Keymaster

    It's done. Please check your account.

Viewing 15 posts - 781 through 795 (of 3,958 total)