Forum Replies Created
-
AuthorPosts
-
Anh Tran
KeymasterSomehow I removed the post id. I've just added in the version 1.3.3, please update the plugin and use the code below:
add_action( 'rwmb_frontend_after_process', function( $config, $post_id ) { if ( 'nuovo-ordine' === $config['id'] ) { wp_safe_redirect( '?rwmb-form-submitted=nuovo-ordine&post_id='.$post_id ); die; } }, 10, 2 );I added the 2nd parameter
$post_idto the hook. Please try and let me know how it works.Anh Tran
KeymasterHi,
The problem with this method is the translation files are not loaded from translate.wordpress.org. It works only with local translation files which are included directly inside the plugin. The translation from translate.wordpress.org is preferred since it allows users to contribute easily and distribute more reliably. Besides, it has a higher priority, meaning if a language is available on both translate.wordpress.org and inside plugin, the file from translate.wordpress.org is loaded.
For example, this is the translation page for Meta Box in Vietnamese:
https://translate.wordpress.org/locale/vi/default/wp-plugins/meta-box
Translation files from translate.wordpress.org are stored in
wp-content/languages/plugins/meta-box/and are regularly updated when new translations available.Ideally, I'd love to remove the
languagesfile from the plugin, so only translations from translate.wordpress.org are used. At the moment, some languages are not available on translate.wordpress.org yet.In your case, in order to make it work with your theme without modifying the plugin, you can add this line directly into your theme:
load_textdomain( 'meta-box', plugin_basename( RWMB_DIR ) . '/languages/meta-box-'.get_locale().'.mo' );It works the same way ๐
Anh Tran
KeymasterHello,
The meta info in the media modal which is added by Meta Box is just custom fields of the attachment. You can get it with the helper function
rwmb_meta, like this:$value = rwmb_meta( 'field_id', '', $attachment_id );Anh Tran
KeymasterHi,
I think your jQuery selector is too generic. It targets
.grpsports, which is all element having that class. In the JS code, there's a parameterelementthat you should use to get its parent group element, and add the error message to that group only. Please try this:jQuery('#post').validate({ errorPlacement: function(error, element) { var $group = element.closest('.grpsports'); if ($group.length) { error.insertAfter($group.find('input:text:last')); } } });To target the form in both admin/frontend, you can use multiple selector like
jQuery('#post, .rwmb-form').Anh Tran
KeymasterHello,
The job is almost done. We're fixing some final bugs before releasing new version. Hopefully done before the end of the week.
Anh Tran
KeymasterHi,
The plugin outputs the HTML with custom CSS classes. You can filter to the output of each field to add Bootstrap classes if you want, but that will be a huge work. See the filters here:
https://docs.metabox.io/filters/
I'd suggest you write some custom CSS for the fields. Please inspect the fields' output and add CSS for them. The plugin already output some basic CSS to make them work, and you only have to write CSS to make them fit your design.
Anh Tran
KeymasterHi Kasia,
If you want to verify mime-type, it's best to write a custom validation rule for entered URL.
I created an example for checking with MP4 file:
For writing custom validation rule, please see this:
Anh Tran
KeymasterHi,
To show a meta box for pages only, please just set
'post_types' => 'page'. You don't need to use any extension for this.April 16, 2018 at 9:38 AM in reply to: โ Problem with MB Settings Page in custom plugin with class-tgm-plugin-activation #9227Anh Tran
KeymasterHello,
When do you call this statement
add_filter( 'mb_settings_pages', 'prefix_options_page' );? Do you call it directly from the main plugin's file?The filter
mb_settings_pagesmust be called beforeadmin_menuaction, which is used to add admin menu. That action fires quite early, beforeadmin_init, so if you call it inside a hook, it might not work as expected.Anh Tran
KeymasterHi,
Which version of the Group extension are you using? I remember I fixed this bug a while ago. Please try updating to the latest version.
Anh Tran
KeymasterGlad that you have resolved it.
The jQuery validation plugin is enqueued only when there's any validation rule. And because it's outputted in the admin footer, your script need to be outputted after that. I'd suggest using hook
admin_print_footer_scriptswith high priority to output it. Do not useadmin_footeras it fires beforeadmin_print_footer_scripts, which is used to output enqueued JS.Anh Tran
KeymasterHello,
Please use MB Conditional Logic for this purpose. The extension allows you to show/hide a field based on other fields' values.
April 13, 2018 at 11:45 AM in reply to: โ cloned group autocomplete not working after updating post #9200Anh Tran
KeymasterThanks for your feedback. Let me try to fix it.
Anh Tran
KeymasterHello,
Are all images to loaded before reordering? It's required to load all images before reordering them.
Anh Tran
KeymasterHello,
I've just tested and the custom validation rule works. I think the problem might be the way you enqueue your script (that contains custom rule). Somehow, it's enqueued before jQuery or jQuery validation script is output.
In my test, I use
wp_footerhook with priority 9999 to enqueue the JS, so it's always after jQuery and jQuery validation. Please try and let me know how it goes. -
AuthorPosts