Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

My problem is the script is not registering in the footer it, is just disappearing, although the jquery.js does show up in the head.

I have the following code in my theme's functions.php file:

function wptuts_scripts_with_jquery()
{

    // Register the script like this for a theme:
    wp_register_script( 'custom-script', get_template_directory_uri() . '/js/jquery.fittext.js', array( 'jquery' ), '', true );
    // For either a plugin or a theme, you can then enqueue the script:
    wp_enqueue_script( 'custom-script' );
}
add_action( 'wp_enqueue_scripts', 'wptuts_scripts_with_jquery' );

This is what my template page looks like:

<?php
/*
Template Name:Tech Basics
*/
?>
<?php get_header( 'tech' ); ?>

<div id="quote">
    <h1 id="fittext3">Sending you the techie! son you never had.</h1>
</div>
<script type="text/javascript">
        $("#fittext3").fitText(1.1, { minFontSize: 50, maxFontSize: '75px' });
    </script>
<div class="row mainContent">
    <div class="twelve columns">
        <?php 
        $page_id = 10; // 123 should be replaced with a specific Page's id from your site, which you can find by mousing over the link to edit that Page on the Manage Pages admin page. The id will be         embedded in the query string of the URL, e.g. page.php?action=edit&post=123.

        $page_data = get_page( $page_id ); // You must pass in a variable to the get_page function. If you pass in a value (e.g. get_page ( 123 ); ), WordPress will generate an error. By default, this will return an object.

        echo apply_filters('the_content', $page_data->post_content); // echo the content and retain Wordpress filters such as paragraph tags. Origin from: http://wordpress.org/support/topic/get_pagepost-and-no-paragraphs-problem
?>
    </div>
</div><!--row ends-->
<?php get_footer(); ?>

footer.php:

        </div>
        <!--mainColumns ends-->
    </div>
    <!--main div ends-->
</div>
<!--container ends-->

</body>
</html>
share|improve this question

1 Answer 1

up vote 3 down vote accepted

You need wp_footer() call in your footer, before closing body tag. Theme without it is pretty much considered broken, since things like footer scripts simply can't work without it.

share|improve this answer
    
ok I added <?php wp_footer(); ?> and it worked thanks! –  Anders Kitson Oct 24 '12 at 22:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.