Forum Replies Created
-
AuthorPosts
-
September 1, 2020 at 11:42 PM in reply to: ✅Need help with datepicker on woocommerce checkout page #21591
Long Nguyen
ModeratorHi Jan,
The aim of the plugin MB Frontend Submission is to let the user/visitor can submit posts on the frontend. If you want to add the date picker field to the form checkout, please follow this article to know how to use the plugin Flexible Checkout Fields for WooCommerce.
https://www.wpdesk.net/blog/woocommerce-checkout-datepicker/September 1, 2020 at 11:16 PM in reply to: ✅How to assign a value to a taxonomy without showing it in the form in front-end? #21590Long Nguyen
ModeratorHi Eddy,
We have to use many meta boxes along with the number of locations. WordPress doesn't know the location of the post to assign if you use only one meta box.
You can use the hidden field or other fields even leave the meta box blank with no field, it's just the demo.
Regarding the shortcode, please try to add the snippet code to the file functions.php in the theme folder or use Code Snippets and add the attribute post_type to the shortcode.
[mb_frontend_form id='amsterdam' post_fields="title,content" post_type='work-place']Long Nguyen
ModeratorHi,
You can check the post type by the post ID. Here is the sample code in View.
{% for post in query.posts %} {% if(mb.get_post_type(post.ID) == 'post_type_slug') %} {{ post.title }} - {{ post.url }} {% endif %} <br> {% endfor %}For more information, please follow this documentation https://developer.wordpress.org/reference/functions/get_post_type/.
Long Nguyen
ModeratorHi,
- Post type slug: base_jobs
- Meta box ID: jobs-meta
- Shortcode:
[mb_frontend_form id="jobs-meta" post_fields="title,content" post_type="base_jobs"]
Long Nguyen
ModeratorHi,
If you use the Builder to generate the code then paste the code to the file functions.php, please re-type the name of the field. I'm going to discuss with the developer team to research and cover this case. Thank you.
August 31, 2020 at 10:53 PM in reply to: ✅Duplicate confirmation message when you have multiple mb_user_profile_info on on #21564Long Nguyen
ModeratorHi,
By default, two password fields mark as required. We can use the filter hook
rwmb_profile_info_fieldsto remove this HTML attribute.add_filter( 'rwmb_profile_info_fields', function( $fields ) { $fields['password']['required'] = false; $fields['password2']['required'] = false; return $fields; } );Find more form filter hooks in the file
wp-content/plugins/mb-user-profile/src/DefaultFields.phpLong Nguyen
ModeratorHi,
Please share the code that created the custom table and fields and the code in View. I will take a closer look and give a quick response.
August 31, 2020 at 9:20 AM in reply to: ✅How to assign a value to a taxonomy without showing it in the form in front-end? #21546Long Nguyen
ModeratorHi,
Reproduce your case:
- Create a custom post type, name Work Place.
- Create a custom taxonomy, name Location.
- Create some terms of Location: Amsterdam, Rotterdam, The Hague.
- Create 3 meta boxes: Amsterdam, Rotterdam, The Hague.
- Create a page then add the frontend shortcode.
[mb_frontend_form id='amsterdam' post_fields="title,content" post_type='work-place']- Add the code to assign the location when submitting the post.
add_action( 'rwmb_frontend_after_process', function( $config, $post_id ) { if ( 'amsterdam' === $config['id'] ) { wp_set_object_terms( $post_id, 'amsterdam', 'location' ); } }, 10, 2 );- A screen record for this case https://www.loom.com/share/0ffb0fc49c164cc18ebf74774595cd45.
You can add the code to the file functions.php in the child theme folder or use the plugin Code Snippets.
Long Nguyen
ModeratorHi Toni,
You need to change variables $field_id and $table_name by your value.
{{mb.rwmb_meta( 'field_id', {'storage_type': 'custom_table', 'table': 'table_name'} )}}Long Nguyen
ModeratorHi,
Each post type has its own taxonomy and it is separated in the Location. See my screen record for more information https://www.loom.com/share/6368ef09af6d4072a9ba2251637ba181.
Long Nguyen
ModeratorHi Eddy,
If you select the location Taxonomy Archive, just go to CPT > Taxonomy > Edit a term > View taxonomy, to get the link of the archive page. For example, the WooCommerce Product category https://share.getcloudapp.com/jkuZOJdY.
August 29, 2020 at 10:43 PM in reply to: ✅How to assign a value to a taxonomy without showing it in the form in front-end? #21532Long Nguyen
ModeratorHi,
- get_queried_object_id() is a function get the term ID where the frontend form display. Don't change this function.
– $taxonomy_slug is the custom taxonomy slug, see my screenshot https://share.getcloudapp.com/Z4ukmlK0. In your case, it would belocation.
You can check the meta box ID then set the post's term by using the action hook
rwmb_frontend_after_process. Here is the sample code:add_action( 'rwmb_frontend_after_process', function( $config, $post_id ) { if ( 'xxx' === $config['id'] ) { wp_set_object_terms( $post_id, get_queried_object_id(), 'location' ); } }, 10, 2 );For more information, please follow this documentation.
https://docs.metabox.io/extensions/mb-frontend-submission/#form-actionsLong Nguyen
ModeratorHi,
We can only check the validation (required) for each field if you have two fields text, please check option Required (in Builder) or add the setting
'required' => truefor one field or both.Long Nguyen
ModeratorHi,
We've updated the Online Generator and MB Builder, used the PHP Encoder to encode the Tonal Language (Pestañas, Vehículo, Tiếng Việt) and optimize the generated PHP code. It's not an error PHP code so don't worry about that.
August 29, 2020 at 12:57 PM in reply to: ✅How to assign a value to a taxonomy without showing it in the form in front-end? #21521Long Nguyen
ModeratorHi,
You can use the action hook
rwmb_frontend_after_save_postand the functionwp_set_object_terms()to set the post terms after saving. Here is the sample code:add_action( 'rwmb_frontend_after_save_post', function( $post ) { wp_set_object_terms( $post->post_id, get_queried_object_id(), $taxonomy_slug ); } );For more information, please follow these documents.
https://docs.metabox.io/extensions/mb-frontend-submission/#post-actions
https://developer.wordpress.org/reference/functions/wp_set_object_terms/ -
AuthorPosts