Support » Plugin: File Gallery » [Plugin: File Gallery] file_gallery_shortcode in custom theme templates

  • Hi friends,
    I’m working on a custom theme and will have two types of galleries that I want to display in my “single.php” template. The first is a normal image gallery that will be displayed as a row of thumbnails and use javascript to cycle through the pictures. Below that I want a second row of links for non-image files associated with the same post—these are pdf files and other documents like dwg files, and I’ll just want each one to be shown as an icon with a title as the link to download the file.

    Reading through the File Gallery Help, I learned that I can use the “file_gallery_shortcode” function to call these galleries in my template. So I’m starting by just trying to get the first gallery to show up, but after inserting the code I am not seeing the gallery show up on the post at all. I’m new to WordPress and am no expert with PHP, so I would appreciate if someone could take a look at my code and explain what I’m doing wrong here. Pretty please?

    [Code moderated as per the Forum Rules. Please use the pastebin]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Aesqe


    hi, danielkleindesign 🙂

    try something like this:

    echo file_gallery_shortcode( array('mimetype' => '*dwg,*pdf', 'link' => 'file') );

    if you need to add a custom mimetype to the list of allowed ones, take a look here:

    Thanks very much, this was helpful. Now I have two more, related questions:
    1. I’d like to change the default document icon that is appearing, and include custom icons for the different mime types. Before I decided to use File Gallery I found out that I could just add a class to my main style sheet for the theme (.pdf for example) that includes the custom icon as the background-image. But now when I insert an FG gallery to display these files, the icons are defaulting back to the ugly WP default document icon. Does the class maybe need to be in a custom File Gallery template with its own style sheet—what’s the right way to solve this.

    2. I want these documents to bring up a download dialogue box when clicked, not to open within the browser or open a new page. Is that possible using the ‘link’ => variable, or is it more complicated than that?

    Thanks again!

    Plugin Author Aesqe


    @danielkleindesign: you can change the document icon by using one of these two filters: ‘file_gallery_non_image_thumb_link’ or ‘file_gallery_crystal_url’.

    you can find more info about them in the help file:

    This was really helpful. One question- is it possible to specify a different thumbnail icon for each PDF file?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: File Gallery] file_gallery_shortcode in custom theme templates’ is closed to new replies.