• Hubert Nguyen

    (@hubertnguyen)


    Hi,

    I’m using a custom template and I would like to know what your recommended way of including the template CSS in the page is? Right now, I don’t see the CSS being included in the page automatically, and I would rather not hardcode it. Thx!

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

    (@aesqe)

    @hubert: the CSS file should be included in the page automatically if it’s in the same folder as the gallery.php file and is named gallery.css.

    If this is not working for you, please e-mail me your custom template ([email protected]) and I’ll get back to you asap.

    Thanks ??

    Sorry to revive this old thread, but after hours of searching this is the closest to my problem that I could find.

    For me, the CSS gets included just fine when having the shortcode in a post, however when I try to use either the do_shortcode() or your file_gallery_shortcode() in a template file, the CSS just won’t get loaded.

    Cheers

    I also cannot get it to load the CSS when using my own template (just copied the “file-gallery” template to my “themes/file-gallery-templates” directory as per help file. I can see it loads the right php file by messing with it, however it won’t load the CSS. Not even when putting the shortcode into the post itself this time.

    Plugin Author Aesqe

    (@aesqe)

    @felixschl: yes, unless you use a shortcode within your post content, the CSS files will not be included. They simply cannot be included because they need to be placed in the head of the document. Shortcodes within post content are processed way before those included in your template files and allow File Gallery to enqueue all the needed files. If you call do_shortcode() from a template file, that means that the call will be received _after_ the page head has been processed.

    As for the second question: did you rename the template folder to something else, and modified the CSS file accordingly?

    Thanks for your prompt reply! This is really cool.

    I got the custom template to work, didn’t come to mind I had to change the actual css content, because I though it was generated by the gallery.php but nevermind.

    As to loading the CSS — how would you solve this? wp_enqueue_style() or just always load it or something else maybe?

    Same problem here about the loading of the css… Any solutions?

    I resolved importing the desired CSS via import in the main css, but it means that in case the shortcode is used, the css is imported 2 times. This is not so elegant…

    Plugin Author Aesqe

    (@aesqe)

    I’d definitely recommend using wp_enqueue_style() to avoid duplicate inclusion.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: File Gallery] CSS include?’ is closed to new replies.