wp_enqueue scripts.. (2 posts)

  1. muffin1882
    Posted 3 years ago #

    Hi there,

    I've created a website in HTML & CSS using a framework now I'm converting it to a wordpress theme..

    I'm new to making themes, so please forgive me for being stupid.

    On my HTML I have the following in my <head> ;

    <!-- All JavaScript at the bottom, except for Modernizr which enables HTML5 elements and feature detects -->
    	<script src="js/modernizr-2.5.3-min.js"></script>

    and the following in the footer area I have;

    <!-- JavaScript at the bottom for fast page loading -->
    	<!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if necessary -->
    	<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    	<script>window.jQuery || document.write('<script src="js/jquery-1.7.2.min.js"><\/script>')</script>
    	<!--[if (lt IE 9) & (!IEMobile)]>
    	<script src="js/selectivizr-min.js"></script>

    I have tried to add a slider to an area of my theme but the slider appears broken. After searching I found out it may be because there is conflicts with some of the scripts, and to fix this may be to enqueue these scripts using the functions.php file - however because I'm new (& stupid) to making parent themes I have failed so far as I don't quite understand this..

    Can anyone help me with the code to put in my functions.php file??

    Thanks in advance

  2. Here is a great article from wptuts, which explains the entire process from a functions.php standpoint.

    What you are looking for is first to wp_register_script and then you will need to use wp_enqueue_script.

    Your js files will be in an external folder.. and referenced via the links in the article.

Topic Closed

This topic has been closed to new replies.

About this Topic