Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 3,031 through 3,045 (of 3,708 total)
  • Author
    Posts
  • in reply to: MB Group - clone not working #4182
    Anh TranAnh Tran
    Keymaster

    I've just fixed the bug and released version 4.9.4. Please update!

    in reply to: MB Group - clone not working #4181
    Anh TranAnh Tran
    Keymaster

    Hi guys, I’m checking it now.

    in reply to: Date field return value="2" when save the post #4176
    Anh TranAnh Tran
    Keymaster

    Hi Ferran,

    The 4.9.3 has a fix for this. I’m checking the bug with the Group extension.

    in reply to: Assign Custom Post type to Custom Taxonomy #4171
    Anh TranAnh Tran
    Keymaster

    Are you using the MB Custom Post Type extension?

    Anh TranAnh Tran
    Keymaster

    Are you using the Group extension? Please post your code to register meta boxes.

    in reply to: Using metabox in few plugins at the same time #4155
    Anh TranAnh Tran
    Keymaster

    I think it’s best to check by if ( ! defined( ‘RWMMB_VER’ ) ). Checking by autoloader class seems too late.

    However, I would recommend using TGMA class. It allows you to use the latest version of the plugin among themes/plugins.

    in reply to: Default Value - pre propulate - filter ? #4154
    Anh TranAnh Tran
    Keymaster

    There’s nothing stop you doing that. Simply add keys to fields param, like this:

    ’fields’ => array(
        ‘phone’ => array(
            ‘id’ => ‘phone’,
            ’type’ => ’text’,
            ’name’ => ‘Phone’,
        ),
    )
    in reply to: DateTime picker control time default for timestamp #4132
    Anh TranAnh Tran
    Keymaster

    Hi,

    Why don't you use date picker and select a date, and calculate the expiry time with "date 23:59" by PHP? You might also add a message for users so they're not confused when selecting a date.

    in reply to: Meta Box extension updates and MainWP #4125
    Anh TranAnh Tran
    Keymaster

    Hi @Flikweert, I've just updated the Updater extension. Can you try if it works with MainWP?

    Thanks
    Anh

    in reply to: Include MB Conditional Logic into theme #4123
    Anh TranAnh Tran
    Keymaster

    Glad to see you here @solopine :). Your themes are great!

    in reply to: Meta Box for Yoast not working #4120
    Anh TranAnh Tran
    Keymaster

    FYI, the latest version of the extension works with Yoast SEO plugin. I just forgot to announce that 🙂

    in reply to: Default Value - pre propulate - filter ? #4119
    Anh TranAnh Tran
    Keymaster

    Hi,

    I think normalize filter or field_meta filter both works. However, using normalize filter seems to be better.

    But why don't you just use a condition check when defined meta boxes? I think it's faster. Something like this:

    add_filter( 'rwmb_meta_boxes', function( $meta_boxes ) {
        $field = array(
            'id' => 'test',
            'type' => 'text',
            'std' => 'Default value',
        );
        if ( is_admin() ) {
            $post_id = isset( $_GET['post'] ) ? $_GET['post'] : ( isset( $_POST['post_ID'] ) ? $_POST['post_ID'] : false );
            if ( 1 == $post_id ) {
                $field['std'] = 'Another default value';
            }
        }
        $meta_boxes[] = array(
            // ...
            'fields' => array(
                $field,
                // ...
            ),
        );
        return $meta_boxes;
    } );

    Or you can filter directly to rwmb_meta_boxes to change the std value of a field:

    add_filter( 'rwmb_meta_boxes', function( $meta_boxes ) {
        if ( is_admin() ) {
            $post_id = isset( $_GET['post'] ) ? $_GET['post'] : ( isset( $_POST['post_ID'] ) ? $_POST['post_ID'] : false );
            if ( 1 == $post_id ) {
                $meta_boxes['fields'][0]['std'] = 'Another default value'; // First field
            }
        }
        return $meta_boxes;
    }, 9999 ); // High priority to make sure this function run last
    Anh TranAnh Tran
    Keymaster

    Sorry, it should be get_option:

    $settings = get_option( 'my-option-menu' );
    $top_main_menus = isset( $settings['top_main_menu'] ) ? $settings['top_main_menu'] : array();
    Anh TranAnh Tran
    Keymaster

    You need to use multiple loops:

    $top_main_menus = get_post_meta( get_post_ID(), 'top_main_menu', true);
    if ( !empty( $top_main_menus ) ) {
        foreach ( $top_main_menus as $top_main_menu ) {
            $sub_top_main_menus = empty( $top_main_menu['sub_top_main_menus'] ) ? array() : $top_main_menu['sub_top_main_menus'];
            if ( ! empty( $sub_top_main_menus ) ) {
                foreach ( $sub_top_main_menus as $sub_top_main_menu ) {
                    $text = empty( $sub_top_main_menu['sub_main_menu'] ) ? '' : $sub_top_main_menu['sub_main_menu'];
                    $link = empty( $sub_top_main_menu['sub_menu_link'] ) ? '' : $sub_top_main_menu['sub_menu_link'];
    
                    echo $text;
                    echo $link;
                }
            }
        }
    }
    
    Anh TranAnh Tran
    Keymaster

    Hi,

    To render the shortcode and spaces, you have to do that manually. Here is a sample code:

    echo do_shortcode( wpautop( $meta ) );

Viewing 15 posts - 3,031 through 3,045 (of 3,708 total)