Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 1,921 through 1,935 (of 3,702 total)
  • Author
    Posts
  • in reply to: Can't get Meta Box Custom Table to work #10753
    Anh TranAnh Tran
    Keymaster

    Hi,

    In the docs:

    BLOB and TEXT columns also can be indexed, but a fixed length must be given. Make sure you set the length when you want to index a text column.

    In your code, you make the test_column indexed, but it doesn't have a fixed length. So the code won't run. Change it to the following code will work:

    MB_Custom_Table_API::create( $wpdb->prefix.'data_khusus', array(
        'test_column' => 'VARCHAR(20) NOT NULL',
        'test_column2' => 'TEXT NOT NULL',    
    ), array( 'test_column' ) );
    Anh TranAnh Tran
    Keymaster

    Hi,

    How is the CPT registered? With init hook and priority = 10?

    in reply to: featured image from attached images #10751
    Anh TranAnh Tran
    Keymaster

    Hi Dan,

    The function get_the_post_thumbnail has a filter post_thumbnail_html that you can use to output the correct image:

    add_filter( 'post_thumbnail_html', function( $html, $post_id, $post_thumbnail_id, $size, $attr ) {
        $gallery = rwmb_meta( 'field_id', array( 'size' => $size ), $post_id );
        if ( empty( $gallery ) ) {
            return $html;
        }
        $image = reset( $gallery );
        $html = wp_get_attachment_image( $image['id'], $size, false, $attr );
        return $html;
    }, 10, 5 );
    in reply to: Multiple Address Fields for a Single Post #10750
    Anh TranAnh Tran
    Keymaster

    Hi Bernhard,

    We've just updated the MB Geolocation which now support multiple autocomplete address fields. Please update and let me know how it goes.

    in reply to: Metabox Height Not Expanding #10748
    Anh TranAnh Tran
    Keymaster

    Hi Thomas,

    That's the intended purpose. The color picker should act like a popup and should not change the height of the outer element (tab panel in this case). Because that might make the layout "dance" when we toggle the picker. And that's a bad experience if we're in a group.

    in reply to: Multilingual setup #10741
    Anh TranAnh Tran
    Keymaster

    Hi Dan,

    1. The compatibility with WPML probably is better than Polylang. We have official support from WPML team, and they contributed code to Meta Box. Polylang follows WPML and supports the same thing as WPML does, so it's compatible.
    2. There's nothing special with WPML. Please just follow its documentation. I think one thing most people forget is the language configuration file. So, be sure you check it.

    Cheers,
    Anh

    in reply to: Can't get admin columns to work #10738
    Anh TranAnh Tran
    Keymaster

    Hi Dan,

    All the settings for admin columns are listed in the docs. And in the Builder, you can set the params using dot notation.

    For example:

    • If you just want to show the field in the admin column, set a custom attribute admin_columns to true.
    • If you want to show the field before name column (like I did in the previous comment), set a custom attribute admin_columns to before name.
    • If you want to show the field before name column and has a custom title "Featured Image", then use the dot notation to set a custom attribute admin_columns.position' to 'before name', and another custom attributeadmin_columns.title' to "Featured Image".
    in reply to: Set Default Active Tab #10729
    Anh TranAnh Tran
    Keymaster

    Hi Thomas,

    I've just added tab_default_active setting in version 1.1.0. You just need to set 'tab_default_active' => 'tab_id' in the meta box settings!

    Anh TranAnh Tran
    Keymaster

    Hi,

    Can you check if you register meta boxes under any condition such as is_admin() or inside a hook? It's required to put the code that register meta boxes (add_filter('rwmb_meta_boxes', ...)) not inside any condition.

    The rwmb_get_registry returns a registry, e.g. a storage, of all registered meta box objects. You can use that registry to get all meta boxes via get( 'all' ) method.

    The statement:

    $meta_boxes = rwmb_get_registry( 'meta_box' )->get( 'all' );

    actually means:

    $meta_box_registry = rwmb_get_registry( 'meta_box' );
    $meta_boxes = $meta_box_registry->get( 'all );

    To get meta values for a specific page ID, please use the 3rd parameter in the helper functions:

    $value = rwmb_meta( 'field_id', '', $page_id );

    For more info, please read the docs.

    in reply to: Can't get admin columns to work #10726
    Anh TranAnh Tran
    Keymaster

    Hi Dan,

    1. You can find the info for MB Columns extension here. I understand that there's no explanation in the Builder. I'll think more about updating the Builder to make it clear.
    2. I created a simple single image field and added custom attribute like this:

    https://imgur.elightup.com/AjGtbrS.png

    And here is the result:

    https://imgur.elightup.com/tsq2OL0.png

    in reply to: Metabox Height Not Expanding #10725
    Anh TranAnh Tran
    Keymaster

    Hi Thomas,

    I'm checking and fixing it. Sorry for not letting you know.

    PS: Version 1.1.0 has fixed this. Please update.

    in reply to: Displaying Custom Fields - I feel stupid #10724
    Anh TranAnh Tran
    Keymaster

    Hi Neil,

    I answered you via email, but probably you haven't received it.

    Regarding your case, I think you can insert the value inline in 2 ways:

    • Using the built-in shortcode. Meta Box already has a shortcode for displaying the custom field value. Please see more details in the docs.
    • Or using the integration with BB Themer. It has the "Insert" button (close to the "Connect" button), which insert a shortcode to the text/heading module. It acts exactly like a shortcode and you can use it to insert custom field value inline.

    I hope that works for you. If it still doesn't, please let me know.

    in reply to: "Special Field Type" to group fields? #10713
    Anh TranAnh Tran
    Keymaster

    I got it. So your main purpose is not writing different IDs for groups.

    While this is not recommended, but I think it still works with the current version of Groups. I mean you can set the same ID for sub-fields in different groups. And then you can access to them using the same keys. It should work in most cases. Please just test it.

    in reply to: Get a customizer setting #10712
    Anh TranAnh Tran
    Keymaster

    Yes, it's possible.

    When you create a settings page with MB Settings Page, remember to set the option_name to theme_mods_$themeslug. Then all the settings in the customizer will be available for the settings page and vise versa.

    For more info, please see the docs.

    Anh TranAnh Tran
    Keymaster

    Hi,

    Yes, you can extend the meta box objects. Please use this snippet to get all meta box instances:

    $meta_boxes = rwmb_get_registry( 'meta_box' )->get( 'all' );
    foreach ( $meta_boxes as $meta_box ) {
        // Do whatever you want
    }

    Then you can filter, add/remove more settings to meta boxes. The meta box registry contains all references to real meta box objects. So be careful. Because what you change will affect the whole code.

    PS: Using the filter rwmb_meta_boxes just gives you a copy of array of meta box settings, not real meta box objects.

Viewing 15 posts - 1,921 through 1,935 (of 3,702 total)