treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Where Exactly in My Header.PHP Do I Place Links to Jscripts Files in JS folder of my Theme

  • I am new to WordPress and I would like some help. I am currently converting a HTML website to WordPress and I pretty much have the site going in WP. I want to be sure that I am doing it right so that I avoid future problems.
    Problem: I am not sure on how to call multiple stylesheets and also multiple java script files in my header. Thank you in advance for your help

    Here is what I have done this far.
    <!DOCTYPE HTML>
    <html <?php language_attributes(); ?>>
    <head>
    <meta charset="<?php bloginfo('charset');?>">
    <title>
    <?php
    global $page, $paged;
    wp_title( '|', true, 'right' );
    bloginfo( 'name' );
    $site_description = get_bloginfo( 'description', 'display' );
    if ( $site_description && ( is_home() || is_front_page() ) )
    echo " | $site_description";
    if ( $paged >= 2 || $page >= 2 )
    echo ' | ' . sprintf( __( 'Page %s' ), max( $paged, $page ) );
    ?>
    </title>
    <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
    <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />

    <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
    <link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/coin-slider-styles.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/menusm.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/pagenavi-css.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/superfish.css" type="text/css" media="screen" />

    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/coin-slider.min.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/cufon-yui.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/cufon-colab-b.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/menusm.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/script.js"></script>

    <!--[if lt IE 9]>
    <script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
    <![endif]-->
    <?php if ( is_singular() && get_option( 'thread_comments' ) ) wp_enqueue_script('comment-reply'); ?>
    <?php wp_head(); ?>
    </head>

    <body <?php body_class(); ?>>
    <div id="outerWrapper">
    <header>
    <h1><a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?></a></h1>
    </header>
  • I would actually be including all of those JS files in the footer, just before the closing body tag.
  • Thanks for your help.