Forum Replies Created
-
AuthorPosts
-
June 15, 2023 at 10:53 PM in reply to: ✅MB Revision works for TITLE but not for custom fields #42236
TTI Licensing
ParticipantPeter:
I figured it out. I was adding the custom setting to the individual fields rather than at the field group. Now that I've added the custom setting to the field group, everything is working. Thank you!!
June 12, 2023 at 11:13 PM in reply to: ✅MB Revisions in combination with MB Custom Table and Custom Post Type #42171TTI Licensing
ParticipantI'm having the same problem as Jonathan above. Is there something else that needs to be configuredto get revisions to work?
TTI Licensing
ParticipantAnother way to ask the question: "Can a field group be used in more than one custom post type (CPT)?" I basically have a one-to-many relationship (e.g., TypeA CPT can have multiple associated TypeB CPTs). I've created a custom field group called Implementation with a set of fields. I'd like to use the same group (Implementation) with both CPTs. Can I do that or do I need to create a separate custome field group for the child CPT?
May 11, 2022 at 3:35 AM in reply to: ✅Spacing and Line Returns of data in Custom Field Textarea Are Removed #35976TTI Licensing
ParticipantThat worked. Thank you!
TTI Licensing
ParticipantGot it. But I created the template with Elementor. Is there a template file created by Elementor and if so where is it? Or is the template stored in the database?
TTI Licensing
ParticipantIf I created this in the custom field area of Metabox, where would this code go? Is there a place in the custom field to put php code?
TTI Licensing
ParticipantThat fixed it. Thank you.
TTI Licensing
Participant<?php add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' ); function your_prefix_function_name( $meta_boxes ) { $prefix = ''; $meta_boxes[] = [ 'title' => __( 'References', 'your-text-domain' ), 'id' => 'references', 'post_types' => ['control'], 'fields' => [ [ 'id' => $prefix . 'references', 'type' => 'group', 'clone' => true, 'fields' => [ [ 'name' => __( 'Reference Label', 'your-text-domain' ), 'id' => $prefix . 'myreference_label', 'type' => 'text', ], [ 'name' => __( 'Reference URL', 'your-text-domain' ), 'id' => $prefix . 'myreference_url', 'type' => 'url', ], ], ], ], ]; return $meta_boxes; }Here's my latest shortcode function:
add_shortcode( 'references', function() { $group = rwmb_meta( 'references' ); //return $group; if ( empty( $group ) ) { return ''; } $output = ''; // Reference URL $rlabel = $group['myreference_label'] ?? ''; $rurl = $group['myreference_url'] ?? ''; $output .= '<a href="' . $rurl . '">' . $rlabel . '</a>'; return $output; });TTI Licensing
ParticipantPartially answered my own question by reading the MB Group documentation. Created a custom shortcode like this. However, this is not returning the appropriate values.
Do you see any issues?
add_shortcode( 'references', function() { $group = rwmb_meta( 'references' ); if ( empty( $group ) ) { return ''; } $output = ''; // Reference URL $rlabel = $group['reference_label'] ?? ''; $rurl = $group['reference_url'] ?? ''; $output .= '<a href="' . $rurl . '">' . $rlabel . '</a>'; return $output; } );TTI Licensing
ParticipantIs there a way to display a custom field only to authenticated users regardless of role? We have some fields in security docs that we would like to display to our employees but not to the world. Most of the other custom fields are OK for public display.
-
AuthorPosts