WordPress.org

Ready to get started?Download WordPress

Forums

Make JS run on every page, not just specific template (2 posts)

  1. martijnboersma
    Member
    Posted 1 year ago #

    I have 'ajaxed' my site, and as a result, JS which is supposed to run on a certain page template does not work properly anymore. For example, when I load my site and navigate to FAQs, the Q&A's don't to their harmonica thing.

    My guess is that I will need to edit my theme so that your (FAQ's) JS runs on every page. I have tried editing functions.php and removing the 'if statement' before the JS section that relates to FAQ's. Unfortunately, this didn't do the trick.

    Any pointers would be much appreciated!
    Thanks a lot for your time :-)

  2. Carlos Moreira
    Member
    Posted 1 year ago #

    Hello!

    Check out this WP function:

    http://codex.wordpress.org/Function_Reference/wp_enqueue_script

    Follow some of the examples.

    You'll probably be able to include the JS in every page, adding some code to your functions.php

    Hope it helps!
    Cheers

Topic Closed

This topic has been closed to new replies.

About this Topic