• Hi,

    I am experiencing problems calling file gallery from my single.php file.

    I have used every which way you can add shortcode into template files do_shortcode and file_gallery_shortcode.

    But no matter what settings I have set within the shortcode they dont take effect.

    Everytime they just display as they are now:

    https://www.vsc.im/new/?p=1

    I wish to use the simple (javascript) template, with thickbox it all works fine if i put shortcode straight into WordPress. But I want to avoid that.

    Hope you can help?

    Thanks

    https://www.ads-software.com/extend/plugins/file-gallery/

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

    (@aesqe)

    @old_blueyes:

    when calling the shortcode directly from the template, the CSS and JavaScript files are NOT enqueued automatically – you’ll have to do that manually.

    The reason for this is, the CSS <link> tags must be in the <head> of the document, and since you’re calling the shortcode from within your template, the head part is already generated.

    The only way would be to use JavaScript to inject the CSS <link> in the document after it has loaded – but I really don’t think that’s an generally acceptable solution.

    Aesque,
    since it’s becoming an emerging request, I suggest to implement a tutorial or integrate a solution directly in the plugin. The possibility to embed the gallery EASILY in a template file would be a killer feature, as this would give a great control to theme developers.
    Best regards

    Plugin Author Aesqe

    (@aesqe)

    @thedarkmist:

    I’ll write up a tutorial to explain best practices when using the shortcode within template files.

    And this could be a way to do it from the plugin point of view:

    add a new attribute to the shortcode, ‘force_enqueue’ (true or false)

    if set to true, enqueue javascript files in footer and, depending on a second new attribute – ‘force_enqueue_css’ (‘inject’ or ‘inline’), inject css links into header using javascript (I really dislike this part), or get css file contents and prepend them inline to HTML (in HTML5, if used with the ‘scope’ attribute, <style> tags are allowed inside <body>)

    I’ll think some more about it, but, without output buffering, I don’t think there’s another way to do it…

    I’ll definitely write up a tutorial as soon as I can ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: File Gallery] file gallery single.php’ is closed to new replies.