Fieldset Text Defaults

Support MB Builder Fieldset Text DefaultsResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #29341
    GregGreg
    Participant

    How do I set some defaults for a Fieldset Text? I have the Inputs set to heading/Heading, value/Value. On the post edit screen, I want to display three default Headings for the user, but obviously allow these to be editable (change the defaults, add and remove their own).

    Settings:
    https://www.dropbox.com/s/6flrtxas00404xp/Fieldset%20Text%20settings.png?dl=0

    Desired defaults:
    https://www.dropbox.com/s/7lrt5qdf68e451o/Fieldset%20Text%20desired%20defaults.png?dl=0

    #29344
    Long NguyenLong Nguyen
    Moderator

    Hi,

    It's not possible to add default values for the fieldset text. You can try to create two fields text in a group to set the default value and make them cloneable.

    #29351
    GregGreg
    Participant

    Thanks. I see WP has filters for default content and some others, but not for meta. 🙁 A bit hacky, but I got the desired result with some JS:

    add_action( 'admin_footer', function() {
    ?>
        <script>jQuery(function($){
            var $input1 = $('.post-new-php.post-type-staff_testimonial input[name="attributes[0][heading]"]');
            if(!$input1.length) return;
            var $clone1 = $input1.closest('.rwmb-clone');
            $clone1.siblings('.add-clone').click().click();
            var $clones = $clone1.siblings('.rwmb-clone');
            $input1.val('Position');
            $clones.first().find('input[name^="attributes"]:first').val('Team Member');
            $clones.last().find('input[name^="attributes"]:first').val('Location');
        });</script>';
    <?php
    } );
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.