Support » Fixing WordPress » Loading scripts on a page-by-page basis

  • Resolved vikkineal

    (@vikkineal)


    Hi there

    I’m trying to avoid loading unnecessary js files via the header, by using some PHP to load only certain scripts on certain pages.

    I seem to be having problems with my syntax however for chaining two options together… I want the following code to load if the page isn’t using the template modelpages.php and if it isn’t single.

    Here’s what I’ve cobbled together, but it doesn’t seem to work…

    <?php if (! is_page_template('modelPages.php') || (! is_single()) ) { ?>
    <script type="text/javascript" src="<?php echo bloginfo('template_directory');?>/scripts/jquery.easing.min.js"></script>
    <script type="text/javascript" src="<?php echo bloginfo('template_directory');?>/scripts/supersized.3.2.7.min.js"></script>
    <?php } ?>

    Any ideas?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Loading scripts on a page-by-page basis’ is closed to new replies.