Forums

Add <script> in <head> but ONLY certain pages? (4 posts)

  1. ckad1979
    Member
    Posted 3 years ago #

    I hope I'm in the right place to ask this.

    I am trying to add a few "dynamic html" addons to my site that require a script to be placed in the <head> of my page. Thing is, when I add the script to my header.php file, it places the script on every page which isn't necessary.

    Is there anyway to mark what pages I want scripts to appear on?

    I'm pretty new to working with WordPress. Sorry.

    http://windowdepotva.com/site

  2. cullyott
    Member
    Posted 2 years ago #

    ckad1979,

    I have this same problem. We're trying to make one of our pages include a certain code in the header and footer but I don't want to apply it to all pages. If you've figured it out could you pass it along?

    Thanks,
    Chris

  3. patnz
    Member
    Posted 2 years ago #

    No kidding! I thought this would be a standard thing to do but I can't find a simple answer anywhere!!! I hope someone can help soon!!! :)

  4. patnz
    Member
    Posted 2 years ago #

    So it seems the function to use is wp_enqueue_script() called from your custom template file. The documentation isn't the best but there's a good video tutorial at http://blog.themeforest.net/wordpress/wordpress-for-designers-day-18/
    its quite a long tutorial but the good stuff is just over halfway through.
    Theres wp_enqueue_style() for stylesheets too...

Topic Closed

This topic has been closed to new replies.

About this Topic