Support » Plugin: File Gallery » [Plugin: File Gallery] Template tag: does it make sense?

  • Resolved Francesco Canovi


    I like this plugin so much. I’d like to integrate it in to page template, ’cause I don’t want my client be able to put the shortcode anywere in the page, but only in a predefined place. I also like to code options in the template tag, so the client has only to attach images to the page via the file gallery and forget about all other options.
    Does it make sense? Ho would you implement this? (I’m not really a developer… I’m a project-manager)
    Kind regards.

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



    you can call the main file_gallery_shortcode function from anywhere in your theme. accepted parameters are the same as in the shortcode, just provide them as an array, rather than a string of variables (i’ve noticed some buggy behavior).

    try this, for example:

    echo file_gallery_shortcode(array("size" => "medium", "link" => "file", "columns" => 3));

    this, however, will not automatically enqueue any CSS styles or scripts, so it’s up to you to handle those. if you’re working with custom templates, then you know where you’re calling the function, and you can enqueue any CSS or javascript files as needed.

    hope this helps 🙂

    Well, thank you for the response.
    I’m not a developer and I have basic knowledge of programming. I correctlyt implemented your solution for execute the shortcode inside the template file. But I’m stick with the css inclusion. I directly called it via header.php. It works, but it’s not so elegant. If I use file gallery also as shortcode in the same page, the CSS is duplicated. Can you point me in the right direction? Shuld I use the wp_enqueue_style()? In this case, How can I avouid duplicated enqueques?

    I also want to point you to this new plugin:
    in facts it’s really close to what I was triyng to achieve with file gallery: the possibility to have a gallery in a specified place inside a template tag, avoiding the use of shortcodes.
    i think file gallery should be a bettere solutions, because it relies on the standard WP “attachment” concept. But you should make it more easy and well documented how to resolve problems such the CSS enqueque.
    This is my 2 cents. 😛

    Plugin Author Aesqe



    yes, you should use wp_enqueue_style() to avoid linking of the same CSS files more than once 🙂

    I’ve taken a look at Attachments Pro, and I don’t think that there is anything that plugin can do that File Gallery can’t 🙂

    Writing open source code for mass market, for free, can be a painful process sometimes. Writing documentation for the code can be even more painful 😀

    I think v1.7 is stable enough and ready with the release of File Gallery 1.7-RC10, so I’ll focus on refreshing the help files next.

    Any ideas on how I can make File Gallery easier to use? Just write them here 😉

    The UI is pretty esy in my opinion.
    You should make more easy to integrate the tags int the templates files with some code examples, and resolve the problem of the CSS enqueque (I mean make it automatically enquequed… probably using proper tags instead of executing shortcodes in the themplate).
    It hink the power of file-gallery is that it relies on the standard image attachment of wordpress, but for more control I would like to be more easy to include it within templates.
    That’s all for me.

    Plugin Author Aesqe


    another thread about css and javascript enqueueing when using shortcodes in template files:

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: File Gallery] Template tag: does it make sense?’ is closed to new replies.