Tagged: ,

Viewing 5 reply threads
  • Author
    Posts
    • #5514
      Daniel
      Member

      I’ve known about piklist for a while. I finally have a break in between projects to try to spend some time using it…I am coming from ACF so bear with me as I adjust.

      Is the “file upload” field the proper field to use for images? If so, is there control over the upload limit? (how many files can be attached to that field). If not, what are my options?

    • #5515
      Daniel
      Member

      I just found the answer to my question searching the forum. I need to use the limit validation found here:

      Validating field data

      Is there a way to control the display of the image once it’s inserted? It looks like it’s using the thumbnail size, which is good for small images, but not for banners.

    • #5755
      jivedig
      Member

      @Daniel did you figure this out? It’s on my list of things to check out as well.

    • #5756
      Daniel
      Member

      No. Didn’t find any options.

    • #5757
      pwwwpwww
      Member

      if you look at the code that constructs the file upload meta box (\parts\fields\file.php), you find this at the top of it:

      <?php
        $options = array_merge(
                    array(
                      'button' =>'Add Media'
                      ,'modal_title' =>'Add Media'
                      ,'basic' => false
                      ,'preview_size' => 'thumbnail'
                      ,'textarea_rows' => 5
                      ,'save' => 'id'
                    )
                    ,isset($options) && is_array($options) ? $options : array()
                  );
      ?>

      So I’m guessing you can do this:

      `piklist(‘field’, array(
      ‘type’ => ‘file’
      ,’field’ => ‘upload_basic’
      ,’scope’ => ‘post_meta’
      ,’label’ => __(‘Add File(s)’,’piklist’)
      ,’description’ => __(‘This is the basic upload field.’,’piklist’)
      ,’options’ => array(
      ‘preview_size’ => ‘thumbnail’ //change this i.e ‘medium’, ‘large’, ‘full’ etc
      )
      ));`

      Not tested, so let me know if it works

    • #5776
      Steve
      Keymaster

      You can use the limit validation rule to limit the number of file uploads.

Viewing 5 reply threads
  • You must be logged in to reply to this topic.