Support Forum » User Profile

Forum Replies Created

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • in reply to: MB Revision works for TITLE but not for custom fields #42236
    TTI LicensingTTI Licensing
    Participant

    Peter:

    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!!

    TTI LicensingTTI Licensing
    Participant

    I'm having the same problem as Jonathan above. Is there something else that needs to be configuredto get revisions to work?

    in reply to: Using the same custom field in several groups #36748
    TTI LicensingTTI Licensing
    Participant

    Another 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?

    TTI LicensingTTI Licensing
    Participant

    That worked. Thank you!

    in reply to: Display Custom Fields ONLY to Authenticated Users #35939
    TTI LicensingTTI Licensing
    Participant

    Got 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?

    in reply to: Display Custom Fields ONLY to Authenticated Users #35929
    TTI LicensingTTI Licensing
    Participant

    If 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?

    in reply to: How to Display a Group of Fields #35928
    TTI LicensingTTI Licensing
    Participant

    That fixed it. Thank you.

    in reply to: How to Display a Group of Fields #35903
    TTI LicensingTTI 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;
    });
    in reply to: How to Display a Group of Fields #35884
    TTI LicensingTTI Licensing
    Participant

    Partially 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;
    } );
    
    in reply to: Password Protection and metaboxes #35693
    TTI LicensingTTI Licensing
    Participant

    Is 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.

Viewing 10 posts - 1 through 10 (of 10 total)