ThemeShaper Forums » Thematic

[closed]

Adding Javascripts To Just The Home Page

(5 posts)
  • Started 11 years ago by JerryRobinette
  • Latest reply from helgatheviking
  • This topic is not resolved

Tags:

  1. JerryRobinette
    Member

    I can't seem to get the "if" statement to work. The other scripts show up fine, but anything in the "if" statement does not appear. Would someone be able to help me with this? Thanks.

    // ADD Javascripts at the bottom of the page

    function child_after() {?>

    <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
    </script>
    <script type="text/javascript">
    _uacct = "XXXXXXX";
    urchinTracker();
    </script>
    <!-- End of Google Analytics code -->

    <script type="text/javascript" src="<?php echo get_stylesheet_directory_uri(); ?>/scripts/jquery.textresize.js"></script>

    <?

    if (is_home()) { ?>

    <script type="text/javascript" src="<?php echo get_stylesheet_directory_uri(); ?>/scripts/jquery.min.js"></script>
    <script type="text/javascript" src="<?php echo get_stylesheet_directory_uri(); ?>/scripts/jquery.slide.js"></script>

    <script type="text/javascript">
    $().ready(function() {
    $('#slideshow').slide({autoplay: true, duration: 8000, showSlideIndex: true});
    });
    </script>

    <?php }

    } // end of function
    add_filter('thematic_after', 'child_after');

    Posted 11 years ago #
  2. JerryRobinette
    Member

    I'm not sure if it matters but I'm using "home.php" for the home page design.

    Posted 11 years ago #
  3. is your home page a static page or your blog index? does it work if you use if (is_front_page()) ?

    Posted 11 years ago #
  4. nimmolo
    Member

    Helga, you are a goddess. I'm saying it in three places today because that's how many times you've helped me. :)))

    Posted 9 years ago #
  5. well thanks! but now that you've dug up this archaic post, i should point out that JerryRobinette should

    1: be using wp_enqueue_script() to load those scripts
    and
    2: should probably either use WP's local version of jquery or the google-hosted version and NOT load it from his/her own theme

    and ps- i really appreciate you digging through the forums to find your answers! they're a gold-mine of info if you have the patience to look. so you rock!

    Posted 9 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.