Forum Replies Created
-
AuthorPosts
-
Long Nguyen
ModeratorHi,
If you want to get the current post ID when registering the meta box, please use this code
$post_id = null; if ( isset( $_GET['post'] ) ) { $post_id = intval( $_GET['post'] ); } elseif ( isset( $_POST['post_ID'] ) ) { $post_id = intval( $_POST['post_ID'] ); }Refer to this topic https://support.metabox.io/topic/get-the-post-id-as-value/
function qrsi_select_advanced( $meta_boxes ) { $prefix = ''; $post_id = null; if ( isset( $_GET['post'] ) ) { $post_id = intval( $_GET['post'] ); } elseif ( isset( $_POST['post_ID'] ) ) { $post_id = intval( $_POST['post_ID'] ); } $meta_boxes[] = [ ... 'fields' => array( array( 'name' => __( 'Courses Block 1', 'your-text-domain' ), 'id' => $prefix . 'courses_block_1', 'type' => 'post', 'post_type' => 'course', 'field_type' => 'select_advanced', 'placeholder' => __( 'Select an Item', 'your-text-domain'), 'query_args' => array( 'relationship' => array( 'id' => 'event-to-course-relationship', 'from' => $post_id, ), ) ) ) ]; return $meta_boxes; }Let me know if it works.
Long Nguyen
ModeratorHi,
The
option_nameof the settings page should belimit_settings. Please correct it and get the value again. Refer to this documentation https://docs.metabox.io/extensions/mb-settings-page/#using-codeLong Nguyen
ModeratorHi,
Thanks for your feedback.
The script files of MB Blocks only load on the post editing page. I will inform the development team to support it on the widget editing page.
January 26, 2022 at 12:39 PM in reply to: Possible to use filters (rwmb_{$field_id}_html) when using custom tables? #33472Long Nguyen
ModeratorHi Paul,
Yes, you can use this filter for any field, it is the HTML input of the field and is not affected by the value of the field (saved in a custom table or not).
add_filter( 'rwmb_fieldID_html', function( $field_html, $field, $meta ) { $field_html .= '<p>Add your HTML code here</p>'; return $field_html; }, 10, 3 );Long Nguyen
ModeratorHi,
Currently, there is no option to change the confirmation page. You can translate the text "Your account is confirmed successfully." to another language by using a translation plugin.
January 26, 2022 at 12:06 AM in reply to: Custom Fields & Setting not showing on Edit Field Group #33460Long Nguyen
ModeratorHi,
Please try to deactivate all plugins except Meta Box, Meta Box AIO and switch to the standard theme of WordPress (Twenty TwentyOne) then re-check the issue.
Let me know how it goes.
Long Nguyen
ModeratorHi,
To allow the users to upload files on the frontend to their profile, you need to use the profile shortcode. Please read more on the documentation https://docs.metabox.io/extensions/mb-user-profile/#edit-profile-form
[mb_user_profile_info id="meta-box-id" submit_button="Submit" confirmation="Your information has been successfully submitted. Thank you."]Here is the example: https://monosnap.com/file/XRr2i07B54v2lWHUJpIDs5B0dsuYzR
Long Nguyen
ModeratorHi,
The View will generate the field ID which you register under the meta box on step 4
https://metabox.io/add-star-ratings-to-wordpress-on-backend/#step-4-create-custom-fields-to-add-star-ratings-with-mb-star-rating-pluginThe plugin from Github helps you to create the custom field type. You also have to create a custom field based on that field type.
But it will display the value of the
ratingfield which should be 1, 2, 3 ... instead of stars. So you need to use the proxy to run the helper functionrwmb_the_value()like the tutorial{{ mb.rwmb_the_value( 'rating' ) }}https://docs.metabox.io/rwmb-the-value/
https://docs.metabox.io/extensions/mb-views/#running-php-functionsI also see the file
dashicons.ttfis missing in the plugin folder, you can copy it from the WP folder/wp-includes/fonts/dashicons.ttfto/wp-content/plugins/mb-rating-field-main/fonts/dashicons.ttfLong Nguyen
ModeratorHi Sascha,
You need to add the ID of the column to show a custom field column before/after that column. The ID of the product categories column is
product_cat, screenshot https://monosnap.com/file/7BqsTDfQoB0Hxqp1dO90UBgLa3JG1HAnd please notice, you should never share the credentials via this public forum. If you want, please share it via this contact form https://metabox.io/contact/
Long Nguyen
ModeratorHi Ryan,
"Courses are connected to Events" so there is a relationship meta box shows the
coursesconnect to the currenteventand you can add morecoursesconnected. Why do you need to create a new fieldpostwhich works like the relationship?The difference is the field
postsaves the value as post meta in the tablewp_postmetawhile the relationship saves the value in a custom tablewp_mb_relationships.Long Nguyen
ModeratorHi,
No, it is not supported to use custom table meta with WP Query. You can query posts by getting the post IDs in the custom table.
global $wpdb; $ids = $wpdb->get_col( "SELECT ID FROM your_table WHERE field1 = 'value1' OR field2 = 'value2'" ); if ( empty( $ids ) ) { echo 'There is no posts'; } else { $query = new WP_Query( [ 'post_type' => 'post', 'post__in' => $ids, ] ); // Do something }Long Nguyen
ModeratorHi,
Here is an example:
{% set args = { post_type: "post", posts_per_page: 6, tax_query: [ { taxonomy: 'category', field: 'slug', terms: my_term } ] } %} {% set posts = mb.get_posts( args ) %} {% for post in posts %} <p>{{ post.post_title }}</p> {% endfor %}Shortcode:
[mbv name="shortcode" my_term="uncategorized"]Long Nguyen
ModeratorHi,
You can just combine to code to add the post title to email content.
add_action( 'rwmb_frontend_after_process', function( $config, $post_id ) { $value = empty( $_POST['submit_form_for_review'] ) ? null : $_POST['submit_form_for_review']; if ( $value == 1 ) { $value = empty( $_POST['post_title'] ) ? null : $_POST['post_title']; wp_mail( '[email protected]', 'New submission', 'A new post has been just submitted from '. $value .' user' ); wp_safe_redirect( 'submitted' ); die; } }, 10, 2 );Long Nguyen
ModeratorHi,
If you follow the tutorial to create the rating field, you can click on the button Insert Field and select the rating field to output with the view.
{{ post.rating }}Long Nguyen
ModeratorHi,
There is no problem with the dash or underscore character. Please correct the field ID, taxonomy slug (not the term slug) and check the output value again.
-
AuthorPosts