Support » Plugin: WP Scripts & Styles Optimizer » CSS files need to load in ‘head’ instead of footer

  • Hi,

    The CSS files need to load in <head> section instead of footer. How do I achieve that with this plugin?

    Kind regards,

    Yunis

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Hendrik Lersch

    (@riddler84)

    Usually all CSS files should be included in the <head> section of your site, because in WordPress it’s not possible to enqueue these files into the footer, if you (or any plugin) use the recommended methods. With this plugin it’s possible, because i use another hook and force WordPress to include them into the footer.

    But you have to do it manually. If there are CSS-files in the footer for some reason you can easily move them in the header via the options you have on each item.

    Edit:
    Notice that this plugin can only handle JS and CSS files which are registered and enqueued with the appropriate functions.

    https://developer.wordpress.org/reference/functions/wp_enqueue_script/
    https://developer.wordpress.org/reference/functions/wp_enqueue_style/

    It can’t handle files which are directly included anywhere in the template files.

    Hendrik,

    I am trying to resolve the problem you see in the first split second after you go to this page: https://druzal.com/select-filter/

    In the first split second, you will see this: https://postimg.cc/F73m5HCh
    If you didn’t see it, refresh the page browser tab.

    Apparently, it is caused by CSS files being loaded in the footer of the page instead of the <head> section of the page.
    How can your plugin be used force the loading of CSS files in the ‘head’ instead of the footer and resolve the problem?

    Kind regards,

    Yunis

    • This reply was modified 9 months, 3 weeks ago by  Yunis777.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘CSS files need to load in ‘head’ instead of footer’ is closed to new replies.