WordPress.org

Ready to get started?Download WordPress

Forums

Inline print of wp_head(); (8 posts)

  1. Dezio
    Member
    Posted 1 year ago #

    Hello,
    Is there a way to print wp_head(); js/css inline?
    Like:

    <script type='text/javascript' src='http://www.site.com/wp-content/plugins/js/jquery.min.js'></script><script type='text/javascript' src='http://www.site.com/wp-content/plugins/js/jquery.2.js'></script><script type='text/javascript' src='http://www.site.com/wp-content/plugins/js/jquery.3.js'></script>

    All on the same line

  2. esmi
    Forum Moderator
    Posted 1 year ago #

    Why would you need to do that?

  3. Dezio
    Member
    Posted 1 year ago #

    Cause I use this way on all website that I dev. Looks a better coding and code pov :)

  4. esmi
    Forum Moderator
    Posted 1 year ago #

    It's no better coding wise IMO. Are you enqueuing your scripts correctly?

  5. Dezio
    Member
    Posted 1 year ago #

    All working well, it's just a point of view. I do all my header inline, and I would know if is possibile to do that with wp, just that :)

  6. esmi
    Forum Moderator
    Posted 1 year ago #

    Not via wp_enqueue_script() as far as I am aware.

  7. bcworkz
    Member
    Posted 1 year ago #

    You could hook the "wp_head" action and echo your line out from there, but there is no guarantee every theme will make the call to invoke this action. From a stability and reliability standpoint you are much better off using wp_enqueue_script().

  8. Dezio
    Member
    Posted 1 year ago #

    Too complicated :D
    Thank you

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.