Forum Replies Created
-
AuthorPosts
-
Anh Tran
KeymasterThere’s nothing stop you doing that. Simply add keys to
fieldsparam, like this:’fields’ => array( ‘phone’ => array( ‘id’ => ‘phone’, ’type’ => ’text’, ’name’ => ‘Phone’, ), )Anh Tran
KeymasterHi,
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.
Anh Tran
KeymasterHi @Flikweert, I've just updated the Updater extension. Can you try if it works with MainWP?
Thanks
AnhAnh Tran
KeymasterFYI, the latest version of the extension works with Yoast SEO plugin. I just forgot to announce that 🙂
Anh Tran
KeymasterHi,
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_boxesto change thestdvalue 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 lastSeptember 17, 2016 at 8:15 AM in reply to: MB Settings Page set multi 'group' and 'clone', how to display in the frontend #4111Anh Tran
KeymasterSorry, it should be
get_option:$settings = get_option( 'my-option-menu' ); $top_main_menus = isset( $settings['top_main_menu'] ) ? $settings['top_main_menu'] : array();September 16, 2016 at 2:38 PM in reply to: MB Settings Page set multi 'group' and 'clone', how to display in the frontend #4104Anh Tran
KeymasterYou 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; } } } }September 15, 2016 at 5:24 PM in reply to: Cloenable group with WYSIWYG with shortcodes and non-breakable spaces #4098Anh Tran
KeymasterHi,
To render the shortcode and spaces, you have to do that manually. Here is a sample code:
echo do_shortcode( wpautop( $meta ) );Anh Tran
KeymasterHi,
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' ).Anh Tran
KeymasterI'm debugging :(. Another error appears and I have to fix it. I'm trying to do that as fast as possible.
Anh Tran
KeymasterIt's fine :). If you see any error, please just let me know.
Anh Tran
KeymasterFYI, the new version is released and it would have the fix for this bug.
Anh Tran
KeymasterWe have a ticket on this but haven't made any progress. We will try to do this. Let's tracking on Github.
September 11, 2016 at 10:18 PM in reply to: Including/Excluding via page template when templates in subdirectory #4062Anh Tran
KeymasterHi,
If you put the page template in a subfolder
page-templates, you need to use'include' => 'page-templates/name.php'instead of justname.php. -
AuthorPosts