Run Scripts only on designated Pages
-
We have a lot of plugins to run our 3,000 member website. We need a lot of functionality. I want lighten up the website by only running scripts on their designated pages. I’m starting with our classifieds plugin.
I tried to print the script only on the page and it didn’t call the script at all on any pages.
if (is_page(1727)) { add_action('wp_print_scripts', 'awpcpjs',1); }Then I tried to print the script on all pages but home, but it loaded the script on the home page.
if (!is_home()) { add_action('wp_print_scripts', 'awpcpjs',1); }Any suggestions? I know this is a lot of customization that doesn’t allow for easy updates of plugins. I only want to add it to a few plugins, not all. But at the moment, our site loads 200kb in javascripts on the homepage and I want to reduce it.
The topic ‘Run Scripts only on designated Pages’ is closed to new replies.