• Hai Friends,

    Where to place a javascript file in a theme?How to call that javascript file?Do we need to create a folder like “SCRIPTS” in a theme and call them as <script type=”text/javascript” src=”/scripts/filename.js”></script>?Please let me know the solution

    Regards
    Basanth

Viewing 1 replies (of 1 total)
  • You can place script files in a “scripts” directory within your theme’s directory and then source them with:

    <script type="text/javascript" src="<?php bloginfo("template_url"); ?>/scripts/filename.js"></script>

    alternatively, you can use the the wp_enqueue_script function in your functions.php file.

    <?php wp_enqueue_script( 'handle', 'src', 'deps', 'ver'); ?>

    for information on this function see:

    http://codex.wordpress.org/Function_Reference/wp_enqueue_script

Viewing 1 replies (of 1 total)

The topic ‘Java Script file in Theme’ is closed to new replies.