Title: file_gallery_shortcode help
Last modified: August 19, 2016

---

# file_gallery_shortcode help

 *  [ttiefenbach](https://wordpress.org/support/users/ttiefenbach/)
 * (@ttiefenbach)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/file_gallery_shortcode-help/)
 * I’m trying to use the “file_gallery_shortcode” to retrieve the first image of
   the gallery to display as a “featured” image on the home page. I can’t find an
   explanation for the different options.

Viewing 13 replies - 1 through 13 (of 13 total)

 *  Thread Starter [ttiefenbach](https://wordpress.org/support/users/ttiefenbach/)
 * (@ttiefenbach)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/file_gallery_shortcode-help/#post-1663964)
 * I think I’m missing something with the correct usage of this shortcode. I’m using
   this PHP to get the first image:
 * <?php echo file_gallery_shortcode( array(‘id’ => $post->ID, ‘size’ => ‘full’,‘
   attachment_ids’ => 1, ‘output_type’ => ‘object’) ); ?>
 * It really doesn’t matter what I put in the array, it always displays the defaults.
   So if I specified: ‘id’ => 398, and no other options, it still displays the current
   post.
 * I hope that clarifies a little.
 *  [Aesqe](https://wordpress.org/support/users/aesqe/)
 * (@aesqe)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/file_gallery_shortcode-help/#post-1664117)
 * Hi, ttiefenbach 🙂
 * It seems I’ve overlooked the ID part of the original WordPress gallery implementation.
   Right now, it is only used if you specify a media tag list and set ‘tags_from’
   to true…
 * I’ll try to release a new version today to fix this.
 * Sorry for the inconvenience :/
 *  Thread Starter [ttiefenbach](https://wordpress.org/support/users/ttiefenbach/)
 * (@ttiefenbach)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/file_gallery_shortcode-help/#post-1664118)
 * Is it possible to get the first image of the gallery using tags? I’m looking 
   for instructions on the meaning of the different shorthand variables too. thanks
 *  [Aesqe](https://wordpress.org/support/users/aesqe/)
 * (@aesqe)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/file_gallery_shortcode-help/#post-1664119)
 * you could do something like this:
 *     ```
       $images = file_gallery_shortcode(array("id" => $post->ID, "tags" => "example-tag", "tags_from" => "current", "link" => "file", "size" => "medium", "orderby" => "post_date", "output_type" => "array"));
   
       $image = $images[0];
       ```
   
 * $image would then contain an array with all the information about the first image
   found for those args.
 * $image[‘params’] would contain additional image information supplied by File 
   Gallery, something like this:
 *     ```
       [params] => Array
               (
                   [image_class] =>
                   [link_class] =>
                   [rel] =>
                   [title] => IMG_2205
                   [caption] =>
                   [description] =>
                   [thumb_alt] =>
                   [link] => http://wpcl.localhost/wp-content/uploads/2010/09/IMG_2205.jpg
                   [thumb_link] => http://wpcl.localhost/wp-content/uploads/2010/09/IMG_2205-300x225.jpg
                   [thumb_width] => 300
                   [thumb_height] => 225
               )
       ```
   
 * hope this helps 🙂
 *  [Aesqe](https://wordpress.org/support/users/aesqe/)
 * (@aesqe)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/file_gallery_shortcode-help/#post-1664120)
 * forgot to add:
 * you should also include “limit” => 1 as argument to optimize mysql query
 *  [Aesqe](https://wordpress.org/support/users/aesqe/)
 * (@aesqe)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/file_gallery_shortcode-help/#post-1664121)
 * Also, I was wrong in my earlier post (why don’t I look at my own code first is
   beyond me…) – just tested with only id of another post and the function works
   as intended for me. Which version of the plugin are you using?
 * file_gallery_shortcode(array(“id” => some_id)) works for me just fine…
 * (sorry for multiple postings)
 *  Thread Starter [ttiefenbach](https://wordpress.org/support/users/ttiefenbach/)
 * (@ttiefenbach)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/file_gallery_shortcode-help/#post-1664124)
 * Thanks for your help. OK, so I tested the version I originally wrote:
    `echo 
   file_gallery_shortcode(array(‘id’ => 398));` versus the code you wrote: `echo
   file_gallery_shortcode(array("id" => 398));`
 * The only difference is the single vs. double quotes. The double quote worked 
   perfectly, like you said it would. I copied the single quote, though, from the
   help file. If the double quote is the only way it works, I guess the help needs
   to be updated???
 * Sorry to drap this post out, but, I’d like to get a description and different
   options available for each variable, i.e.: “size” => “full”, “thumbnail”, “medium”,
   etc. I don’t know what is available to me to use.
 * Thanks again for your help. I’m super excited to start utilizing your gallery
   on my new site. I’ll have to make sure I donate something for the cause!!
 *  Thread Starter [ttiefenbach](https://wordpress.org/support/users/ttiefenbach/)
 * (@ttiefenbach)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/file_gallery_shortcode-help/#post-1664125)
 * How do I make the link be the file location, not the [http://www.domain.com/?attachment_id=399](http://www.domain.com/?attachment_id=399)
 * Thanks.
 *  Thread Starter [ttiefenbach](https://wordpress.org/support/users/ttiefenbach/)
 * (@ttiefenbach)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/file_gallery_shortcode-help/#post-1664126)
 * never mind on my last post. I changed the “link” parameter… duh!
 *  [GsT](https://wordpress.org/support/users/gst/)
 * (@gst)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/file_gallery_shortcode-help/#post-1664168)
 * Hi,
 * Wow, great plugin! Really useful especially with the WPML support and all. Thx!
 * I´m trying to get the first image aswell (for my product listing page) from the
   gallery query, but I´m stuck. Any help for this PHP beginner would really be 
   appreciated!
 * I need the first pic to be a link which then will open a modal box (Lighbox Plus
   plugin) to all the attached images where I can scroll through the gallery. I 
   hope that made sense!! :o)
 * In other words I would like to show only one thumbnail on the actual page per
   product, this in order to save same space in the design.
 *  [Aesqe](https://wordpress.org/support/users/aesqe/)
 * (@aesqe)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/file_gallery_shortcode-help/#post-1664170)
 * [@gst](https://wordpress.org/support/users/gst/):
 * I’m afraid that’s something you’d have to code yourself, part PHP, part JavaScript…
 * Getting and displaying only the first image, or the post thumb image, is easy,
   but the rest requires JavaScript to open a modal window in which you’d display
   a custom URL or just part of that same page, or the whole same page with different
   query vars, a specialized template, etc…
 * It’s really something that would need to be custom made.
 * I’d gladly help you, but between my day job and working on File Gallery, there’s
   not much free time left for me, sorry… :/
 * But I’m really glad you like the plugin and if you have any problems with getting
   something out of it, just fire the questions away 🙂
 *  [GsT](https://wordpress.org/support/users/gst/)
 * (@gst)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/file_gallery_shortcode-help/#post-1664171)
 * Thx Aesqe for the fast reply!
 * I knew this wasn´t going to be a walk in the park. 😉
 * Well I guess I have to settle for the other option, making the product list with
   categories (with one thumbnail) and the single posts with the whole gallery included
   for every specific product.
 * Thx again, and yeah it´s a real cracker plugin! The WPML integration is awesome,
   something we probably will see in future editions of their great plugin aswell
   as a default feature I hope. 😛
 *  [Aesqe](https://wordpress.org/support/users/aesqe/)
 * (@aesqe)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/file_gallery_shortcode-help/#post-1664176)
 * Thanks GsT, and good luck with your templating 🙂

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘file_gallery_shortcode help’ is closed to new replies.

 * 13 replies
 * 3 participants
 * Last reply from: [Aesqe](https://wordpress.org/support/users/aesqe/)
 * Last activity: [15 years, 8 months ago](https://wordpress.org/support/topic/file_gallery_shortcode-help/#post-1664176)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
