Forum Replies Created
-
AuthorPosts
-
October 14, 2020 at 11:25 PM in reply to: ✅calculation in fields | success/error-messages | jQuery version #22396
Long Nguyen
ModeratorHi,
Regarding jQuery version: Meta Box and extensions are compatible with the newest version of jQuery 3.5.1 but it's not encouraged because of WordPress core use 1.12.4, using the newest version of jQuery might break some plugins/themes and it also breaks the Meta Box's JavaScript function.
As you can see the green success message is completely wrong positioned.
Therefore I would like to hide this message and create my own message using jQuery…
So I am able to position/style the success or error messages in a way the design requires it.It looks so weird when the form submitted and the field still shows next to the confirmation box. Could you please share the code which creates the field and shortcode to show the frontend form?
I thought I can show the results inside the field (like multi-select field)
The field
autocompletehelps you to select an option from the list and show below the field, you can select other options after. If you want to show like the multi-select, please use the field select_advanced.Can I use an external submit button and hide the one used inside MB (e.g. for design reason) and using jQuery for submit function (if please show a simple example).
Yes, you can create a custom button that has ID
custom-submitthen use this JavaScript code to hide the form submit button and trigger click this submit button when clicking the custom button.jQuery(document).ready(function($) { $('.rwmb-form-submit button').hide(); $('body').on('click', '#custom-submit', function() { $('.rwmb-form-submit button').trigger('click'); }); });Long Nguyen
ModeratorHi,
Maybe the condition
has_post_thumbnail() && $shoppingcart_display_page_single_featured_image == 0returns false so it does not run the code.You can try to add the code after the <article> tag, just like
<article id="post-<?php the_ID(); ?>" <?php post_class();?>> <div class="entry-meta"> <?php echo rwmb_meta( 'prefix-Neck' ) ?> </div> ...October 14, 2020 at 10:42 AM in reply to: ✅calculation in fields | success/error-messages | jQuery version #22381Long Nguyen
ModeratorHi there,
> hide the standard success or error messages (on MB-form-level and on single field level)
What is the success and error message? We can simply hide the messages with some custom CSS code without touching other complicated PHP code.
> catch the values with jQuery script (please create a small/simple example)
I've created three
numberfields with the corresponding ID: width, length, square_meters. Using a small Javascript code to get two fields value and set the square value for the field square_meters.jQuery(document).ready(function($) { $('body').on('keyup', '#width, #length', function() { var width = $('#width').val(); var length = $('#length').val(); var square_meters = width * length; $('#square_meters').val(square_meters); }); });See more in my screen record https://www.loom.com/share/568c0be8096542c3bb05e2eb3fa6f75c.
> Which jQuery is needed (frontend/backend) to work with metabox?
What happens if I change WordPress to the newest version?Meta Box uses the jQuery version depend on WordPress core 1.12.4 when enqueueing the script file, you can just use
array( 'jquery' )for the $deps parameter.For more information, please follow the documentation.
https://developer.wordpress.org/reference/functions/wp_enqueue_script/#comment-content-276Long Nguyen
ModeratorHi Marie,
You simply show the field's value in the loop
while{...}, just an entry meta. The code should be:<div class="entry-meta"> <?php echo rwmb_meta( 'prefix-Neck' ) ?> </div>Long Nguyen
ModeratorHi,
The plugin MB Custom Table also works in the multisite environment. If you use the phpMyadmin to create a table, please follow the notes to make the custom field works with that table.
https://docs.metabox.io/extensions/mb-custom-table/#using-existing-tables.
https://docs.metabox.io/extensions/mb-custom-table/#notesLong Nguyen
ModeratorHi,
The field
taxonomyonly supports to show the list of taxonomies with settings, not support filtering by another field's value.If a section (s) only belongs to one course, I think you can add the section as sub-courses (hierarchical). Then use the field type
select_treeorcheckbox_treeto select a section base on a course.Long Nguyen
ModeratorHi,
It's a premium plugin so I have not checked the compatibility with this plugin before. Could you please share a copy of it? I will create a feature request for the developer team to cover this case in a future update.
You can also use the WPML plugin to translate your site and custom fields, it's compatible with Meta Box. Follow this article for more information https://metabox.io/translate-custom-fields-with-wpml/.
Long Nguyen
ModeratorHi,
I think you can load in two separate folders, one for Meta Box plugin only, one for other extensions. It also needs to create two files composer.json and run it twice. Then easy to check and require the file autoload.php.
if( ! class_exists( 'RWMB_Loader' ) ) { require 'meta-box/vendor/autoload.php'; // code goes here } if ( class_exists( 'RWMB_Loader' ) ) { require 'extensions/vendor/autoload.php'; // code goes here }October 12, 2020 at 2:34 PM in reply to: ✅Problem with MB Frontend Submission and wp multisite #22349Long Nguyen
ModeratorHi,
We have released a new version 1.7.4 of the MB User Profile extension to cover this issue. Please update it and let me know how it goes.
October 11, 2020 at 6:22 PM in reply to: ✅Can I specify the format of contents field in frontend? #22341Long Nguyen
ModeratorHi Eddy,
Please follow this tutorial to know how to create a custom field WYSIWYG and replace the content of the default editor of WordPress. You can change to the field
textareaas you want.Long Nguyen
ModeratorHi,
Because the helper function
rwmb_meta()runs after the filter hookrwmb_meta_boxesso you can use the function get_option() to get settings page value inside the function callback.$allergens = get_option( 'options' )['list'];Long Nguyen
ModeratorHi,
The extension MB Yoast SEO Integration only works with single fields (not in a Group or a Block). We are trying to make it works with Group and Block in the future update.
Thank you.
Long Nguyen
ModeratorNo, the autoloader is the must use. You should check class exists before requiring the file autoloader.
if( ! class_exists( 'RWMB_Loader' ) ) { require 'vendor/autoload.php'; // code goes here }October 9, 2020 at 9:50 AM in reply to: ✅Problem with MB Frontend Submission and wp multisite #22328Long Nguyen
ModeratorHi,
Please try to upload different images to check this issue again. Also, share the image file
project-placeholder.png, I will try to upload it on my end. Maybe there is a problem with this file or it was broken.Long Nguyen
ModeratorHi,
Any themes or plugins can use the Meta Box as a library so if you also create your plugin and use the Meta Box, please check it if exist before running other code.
if( ! class_exists( 'RWMB_Loader' ) ) { // code goes here } -
AuthorPosts