Forum Replies Created
-
AuthorPosts
-
Anh Tran
KeymasterDear Jeremy,
Please grab the latest version (2.1) and recreate your Meta Box.
Best regards,
Tan
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
KeymasterHmm, that's weird, let me check and tell you when I found the problem π
Anh Tran
KeymasterDear solopine,
Thanks for using our plugin. Previously, users have to define
MBC_JS_URLconstant 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!
Anh 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();Anh Tran
KeymasterDear 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
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; } } } }Anh Tran
KeymasterDear Matt,
Because
post_categoryreturns ids of categories, to cast it to array of slugs, we have to useslug:prefix.post_typereturns string of current post type so we don't have to cast it. So just use:'visible' => ['post_type', 'product']Best regards,
Tan
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
KeymasterSeems that it doesn't works with the latest WP update. I'll push a new update this weekend π
-
AuthorPosts