Forum Replies Created
-
AuthorPosts
-
Peter
ModeratorHello Jo,
To use the sanitize callback, please read more on the documentation https://docs.metabox.io/sanitization/#custom-sanitize-callback
The callback function will look like this
function formatage_prix( $value, $field, $old_value, $object_id ) { // French notation $value = number_format( $value, 2, ',', ' ' ); // use $value to get the field value return $value; // and return the field value after formatting }Peter
ModeratorHello,
Thank you for your feedback.
Do you mean to add a border around the field and the background of the field label to separate them? I will inform the development team to consider improving the UI of custom fields in future updates.
Peter
ModeratorHello,
The MB Conditional Logic extension does not support populating a field value based on another field value. It only helps to show/hide a field (or an element) based on another field value.
Peter
ModeratorHello,
You can try to use this code
add_filter( 'generateblocks_query_loop_args', function( $query_args, $attributes ) { if ( ! is_admin() && ! empty( $attributes['className'] ) && strpos( $attributes['className'], 'only-provider-events' ) !== false ) { return array_merge( $query_args, array( 'relationship' => [ 'id' => 'event_to_provider', // Pass your relationship ID 'to' => get_the_ID(), // You can pass object ID or full object ], ) ); } return $query_args; }, 10, 2 );If it does not work, please generate the relationship to the PHP code and share it here. I will help you to check this.
January 2, 2023 at 7:09 PM in reply to: Return all posts with related posts that have specific meta value #40089Peter
ModeratorDecember 30, 2022 at 11:27 PM in reply to: MB geolocation google address autocomplete not working with conditional logic #40075Peter
ModeratorHello,
I do not see a field with the address ID in your code as instructed in the documentation https://docs.metabox.io/extensions/meta-box-geolocation/#address-field
Also, the geo type should be an array of values, for example:
'types' => ['geocode'],Can you please check recheck this?
December 30, 2022 at 11:17 PM in reply to: Return all posts with related posts that have specific meta value #40073Peter
ModeratorHello Brian,
I think it is possible. You can try to create 2 queries to do that:
- Query to get Band posts that have the Jazz genre meta value
- Inside the query to get Band posts, create another query to get Event posts related to the Band.Please read more on the documentation
https://developer.wordpress.org/reference/classes/wp_query/#custom-field-post-meta-parameters
https://docs.metabox.io/extensions/mb-relationships/#postsPeter
ModeratorHello,
Can you please share the code that you create the query to display Event posts? Did you try to add the parameter
relationshipas in the documentation below to the query?
https://docs.metabox.io/extensions/mb-relationships/#postsDecember 29, 2022 at 9:55 PM in reply to: Require at least 1 field to be filled out to submit post #40062Peter
ModeratorHello,
The JS validation only helps you to validate one field itself. If you want to validate that at least one field has value, please try to use the form validation with PHP code. Read more on the documentation https://docs.metabox.io/extensions/mb-frontend-submission/#validation
December 29, 2022 at 9:45 PM in reply to: MB geolocation google address autocomplete not working with conditional logic #40061Peter
ModeratorHello,
Can you please generate the PHP code and share it with me? I've tried to create a simple case to show/hide the address field but do not see any issue.
Peter
ModeratorHello,
Thanks for your feedback.
I've created a feature request and sent it to the development team to consider supporting this case in future updates.
Peter
ModeratorHello,
I'm not sure if those plugins can take data from Meta Box to work with their functions but if they can work with standard custom fields of WordPress, they can work with some simple fields of Meta Box like text, email, number ...
https://wordpress.org/support/article/custom-fields/Peter
ModeratorHello,
Yes, you can put the code in the template file. Let me know if you have any questions.
Peter
ModeratorHello Pat,
I see you've created a similar question in another ticket https://support.metabox.io/topic/auto-create-the-values-for-relationships/
If you want to create a relationship between two objects (posts, terms, users) by coding, please follow this documentation https://docs.metabox.io/extensions/mb-relationships/#managing-connections-programmatically
If you cannot accomplish this, I recommend hiring an expert developer to help you with this case.
Peter
ModeratorHello,
The example of code is added to the documentation, please check it here https://docs.metabox.io/extensions/mb-relationships/#posts
To get the featured image or other post data, you also need to have a basic knowledge of WordPress coding. For example https://developer.wordpress.org/reference/functions/the_post_thumbnail/
$connected = new WP_Query( [ 'relationship' => [ 'id' => 'posts_to_pages', 'from' => get_the_ID(), // You can pass object ID or full object ], 'nopaging' => true, ] ); while ( $connected->have_posts() ) : $connected->the_post(); ?> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <?php the_post_thumbnail( 'thumbnail', array( 'class' => 'alignleft' ) ); endwhile; wp_reset_postdata(); -
AuthorPosts