Viewing 1 reply thread
  • Author
    Posts
    • #7452
      clubdeuce
      Participant

      Preface: IANAFED (front-end developer).

      When rendering a field inside of an already existing meta box, it does not expand the meta box to include it.

      HTML below:

      
      <div id="project-details" class="postbox " >
          <button type="button" class="handlediv button-link" aria-expanded="true"><span class="screen-reader-text">Toggle panel: Project Details</span><span class="toggle-indicator" aria-hidden="true"></span></button><h2 class='hndle'><span>Project Details</span></h2>
          <div class="inside">
              <p>
                  <label for="featured_project">Featured project</label>
                  <input type="checkbox" id="featured_project" name="featured_project" value="1" class="widefat">
              </p><div class=" piklist-field-container"><div class="piklist-field-container-row"><div class="piklist-label-container"><label for="_post_meta[gallery_images][]" class="piklist-field-part piklist-label piklist-label-position-before " >Gallery images</label><p class="piklist-field-description description">Select/Upload images to use on the single project page</p></div><div class="piklist-field"><div class="piklist-field-part">
      
              <a
                      href="#"
                      class="button piklist-upload-file-button piklist-field-part "
                      title="Select Images"
              >
                  Select Images    </a>
      
              <div class="piklist-upload-file-preview piklist-field-preview">
                  
      
              </div>
      
          </div></div></div></div></div>
      </div>
      </div>
      

      The code used to render the field is as follows:

      
      /**
           * @param string $id
           * @param array  $params
           */
          function _gallery_input( $id, $params ) {
      
              $params = wp_parse_args( $params, [
                  'label' => 'Please enter a label for this field',
                  'modal_title' => 'Select Images',
                  'button_text' => 'Select Images',
              ] );
      
              piklist('field', array(
                  'type' => 'file',
                  'field' => $id,
                  'label' => $params['label'],
                  'description' => __( 'Select/Upload images to use on the single project page', 'rcg' ),
                  'options' => array(
                      'modal_title' => $params['modal_title'],
                      'button' => $params['button_text'],
                      'multiple' => true,
                  ),
              ));
      
          }
      

      Any help would be greatly appreciated.

      Attachments:
      You must be logged in to view attached files.
    • #7472
      Steve
      Keymaster

      @clubdeuce– I’m not sure how Piklist would do that since it’s not building the metabox. Guessing you would need to adjust the css.

Viewing 1 reply thread
  • You must be logged in to reply to this topic.