WordPress.org

Support

Support » How-To and Troubleshooting » wp_enqueue scripts..

wp_enqueue scripts..

  • 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>
    	<![endif]-->

    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

Viewing 1 replies (of 1 total)
  • Josh

    @josh401

    Moderator and Editor Customizer

    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.

Viewing 1 replies (of 1 total)
  • The topic ‘wp_enqueue scripts..’ is closed to new replies.
Skip to toolbar