Forum Replies Created
-
AuthorPosts
-
February 16, 2022 at 11:20 PM in reply to: View is using same post for every item on Posts/Archive page #33947
Long Nguyen
ModeratorHi Brandon,
You can follow this documentation to create a custom query for the archive page https://docs.metabox.io/extensions/mb-views/#custom-query
Then show the post meta or term list on each post.
February 16, 2022 at 11:18 PM in reply to: ✅How to translate custom field labels for different admin users languages ? #33946Long Nguyen
ModeratorHi,
You can share your site credentials via this contact form https://metabox.io/contact/, I will help you to check this issue.
Long Nguyen
ModeratorHi,
If you save field value (color) in the custom table, please follow this documentation to know how to get field value https://docs.metabox.io/extensions/mb-custom-table/#getting-field-value
$background_color = rwmb_meta( 'background_color_picker', ['storage_type' => 'custom_table', 'table' => 'wp_mb_extra_post_fields'], get_queried_object_id() ); echo $background_color;Long Nguyen
ModeratorHi,
The setting
reciprocalhelps you to avoid showing two meta boxes (connect to itself) when you set the relation from an object type to itself. Like thisadd_action( 'mb_relationships_init', 'your_prefix_function_name' ); function your_prefix_function_name() { MB_Relationships_API::register( [ 'id' => 'post-to-post', 'from' => 'post', 'to' => 'post', ] ); }Screenshot https://monosnap.com/file/QwbCPB9qCcHF8ToqkNHDqjZbbzUWwU
If you set
reciprocalfor different object types (CPT) like your case, the connection meta box only shows on thefromobject type page.February 16, 2022 at 4:34 PM in reply to: Settingspage question : 1 CF with tabs or more CF with tabs in settingspages? #33935Long Nguyen
ModeratorHi Cees,
It is not possible to have 1 custom field (field ID) on more tabs. It will not work properly. If you have too many tabs on a settings page, please consider separating them from another settings page.
Long Nguyen
ModeratorHi,
To get the post slug, you can use the property
post_name
{{ post.post_name }}
Refer to the documentation https://docs.metabox.io/extensions/mb-views/#custom-queryThen you can update the post slug with author's name after saving the post by using the WP function
wp_update_post(). Refer to this topic
https://support.metabox.io/topic/append-a-related-posts-title-to-the-title-of-created-post/Long Nguyen
ModeratorHi,
There are two cases:
- If you want to use the field
post(user meta). You can use this code to show the post title - If you want to use the relationship. You can use this code to show the post title
$post_id = rwmb_meta( 'academics_university', ['object_type' => 'user'], 123); echo get_the_title( $post_id );Refer to the documentation https://docs.metabox.io/fields/post/#template-usage
https://docs.metabox.io/extensions/mb-user-meta/#getting-field-value$connected = new WP_Query( [ 'relationship' => [ 'id' => 'relationship_user_university', 'from' => 123, ], 'nopaging' => true, ] ); while ( $connected->have_posts() ) : $connected->the_post(); ?> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <?php endwhile; wp_reset_postdata();Refer to the documentation https://docs.metabox.io/extensions/mb-relationships/#posts
- Remember to change 123 with the user ID.
Long Nguyen
ModeratorHi Ole,
It is possible. You can use the filter
rwmb_normalize_{$field_id}_fieldto change the field type on backend only. For example:add_filter( 'rwmb_normalize_image_upload_ID_field', function( $field ) { if( is_admin() ){ $field['type'] = 'image_advanced'; } return $field; });Read more on the documentation https://docs.metabox.io/filters/#rwmb_normalize_field
Long Nguyen
ModeratorHi,
Thanks for reaching out.
You are using the code to register the meta box and custom fields to save field value to the custom table, not to the settings page. Please follow this documentation to register them on a settings page
https://docs.metabox.io/extensions/mb-settings-page/Long Nguyen
ModeratorHi,
Here is the correct code
add_filter( 'rwmb_test_group_value', 'test_save_field', 10, 4 ); // test a group field by its id function test_save_field( $new, $field, $old, $object_id ) { var_dump($new); die('12345'); //stop the code here return $new; }Use one function for one field ID only.
February 15, 2022 at 10:50 PM in reply to: Validation does not work with rwmb_normalize_field #33920Long Nguyen
ModeratorHi,
Please refer to this topic to know how to use remote validation with the Builder https://support.metabox.io/topic/remote-validation-example/
Then you can check if the username existed or not and echo the true/false value.
Long Nguyen
ModeratorHi Dan,
Did you share the info via the ticket system? I've still not received it.
Long Nguyen
ModeratorHi,
Can you please share the code that creates the relationship between the user and CPT university? If you are using MB Builder, please follow this documentation to get PHP code https://docs.metabox.io/extensions/meta-box-builder/#getting-php-code
February 15, 2022 at 12:39 PM in reply to: View is using same post for every item on Posts/Archive page #33906Long Nguyen
ModeratorHi Brandon,
I see the artist of each post displays as well, screenshot https://monosnap.com/file/Myk62yvsE5bYESGsdkn6FJuEy8wx8n
Did you resolve the issue?
February 15, 2022 at 12:35 PM in reply to: ✅How to translate custom field labels for different admin users languages ? #33905Long Nguyen
ModeratorHi,
When editing a language, you also need to click "Sync" to update new strings from the POT file. Here is the demo https://monosnap.com/file/y7s1CGPchopz2baTeMCrlzYrEk9ODE
- If you want to use the field
-
AuthorPosts