WordPress.org

Ready to get started?Download WordPress

Forums

How to add a .js link into entry header? (2 posts)

  1. allstone
    Member
    Posted 4 years ago #

    Hiyas,

    I'm trying to put a javascript (or import) into a particular entry in WP. Seems like the custom fields area would get close to that function, however, the custom fields doesn't seem to be doing anything, even when I add simple key/value pairs.

    I'm using WP 2.8.4. Is there something about the custom fields that I need to enable somewhere else?

    Can I add a link to a javascript there without doing it from the templates and causing this javascript to load site-wide?

    TIA.

  2. Adam Harley
    Member
    Posted 4 years ago #

    http://codex.wordpress.org/Using_Custom_Fields

    You have to add code in your template to retrieve and process custom field data, depending on what you want to do with the values.

    It would be much easier to just add a wp_enqueue_script() call once in your theme's functions.php to load something site-wide. You could add it in each page's meta (custom field) data and load it from there if you really wanted to though.

Topic Closed

This topic has been closed to new replies.

About this Topic