Custom Fields
Re-Envisioned
Support Meta Box Builder Fieldset Text Defaults

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #29344
    Long 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
    Greg
    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 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.