Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 3,031 through 3,045 (of 3,702 total)
  • Author
    Posts
  • 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 ) );

    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: Meta Box extension updates and MainWP #4084
    Anh TranAnh Tran
    Keymaster

    I'm debugging :(. Another error appears and I have to fix it. I'm trying to do that as fast as possible.

    in reply to: Settings Page Undefined Error #4078
    Anh TranAnh Tran
    Keymaster

    It's fine :). If you see any error, please just let me know.

    in reply to: File Type Upload Error #4064
    Anh TranAnh Tran
    Keymaster

    FYI, the new version is released and it would have the fix for this bug.

    in reply to: Adding post meta to revisions #4063
    Anh TranAnh Tran
    Keymaster

    We have a ticket on this but haven't made any progress. We will try to do this. Let's tracking on Github.

    Anh TranAnh Tran
    Keymaster

    Hi,

    If you put the page template in a subfolder page-templates, you need to use 'include' => 'page-templates/name.php' instead of just name.php.

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