Support Forum Β» User Profile

Forum Replies Created

Viewing 15 posts - 3,136 through 3,150 (of 3,958 total)
  • Author
    Posts
  • in reply to: Added Builder - Got Some Errors #4143
    Anh TranAnh Tran
    Keymaster

    Dear Jeremy,

    Please grab the latest version (2.1) and recreate your Meta Box.

    Best regards,

    Tan

    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: Autocomplete issue with 'id' and binding #4122
    Anh TranAnh Tran
    Keymaster

    Hmm, that's weird, let me check and tell you when I found the problem πŸ™‚

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

    Dear solopine,

    Thanks for using our plugin. Previously, users have to define MBC_JS_URL constant if they want to include it to their own theme, that's why you got that bug. Sorry for inconvenience. We've just updated the plugin and it not requires you to define that constant. Please grab the latest version (1.3.3).

    Cheers!

    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();
    in reply to: Added Builder - Got Some Errors #4110
    Anh TranAnh Tran
    Keymaster

    Dear Jeremy,

    Sorry for that inconvenience, that bug caused when you deleted all post types and fields. Try adding post types and fields back in the builder, if you cannot, try removing that meta box and create it again. We'll put new update shortly.

    Best regards,

    Tan

    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;
                }
            }
        }
    }
    
    in reply to: Display in Custom Post Type #4099
    Anh TranAnh Tran
    Keymaster

    Dear Matt,

    Because post_category returns ids of categories, to cast it to array of slugs, we have to use slug: prefix.

    post_type returns string of current post type so we don't have to cast it. So just use:

    
    'visible' => ['post_type', 'product']
    

    Best regards,

    Tan

    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 ) );

    in reply to: Include Only on Front Page #4097
    Anh TranAnh Tran
    Keymaster

    Hi,

    is_front_page() is a template function and I don't think it works in the backend.

    I suggest get the front page ID and check by page ID. To get the front page ID, just use get_option( 'page_on_front' ).

    in reply to: Missing Export Option #4091
    Anh TranAnh Tran
    Keymaster

    Seems that it doesn't works with the latest WP update. I'll push a new update this weekend πŸ™‚

Viewing 15 posts - 3,136 through 3,150 (of 3,958 total)