Wednesday 1 April 2015

How To add jquery and css in child theme or theme Wordpress

How To add  jquery and css in child theme or theme Wordpress


Hello 

Here We learn that how to add js and css in your theme or child theme.

When you want to add jquery and css using code then fist open your functions.php file

Here add this code for add jquery.


<?php 
function myphpinformation_scripts() {
    
   
    
     
    
            wp_enqueue_script( 'scroll', get_stylesheet_directory_uri() . '/js/script.js',array('jquery'),'',true);
            
             wp_enqueue_style( 'custom-css', get_stylesheet_directory_uri(). '/css/custom.css' );

}

add_action( 'wp_enqueue_scripts', 'myphpinformation_scripts' );
 ?>

we can add jquery using wp_enqueue_script funcion check in above code

we  can add css using wp_enqueue_style funcion check in abovcode

above example code add in your function.php file set your file and check it.

you can also manually add jquery and css file usin


 <script type="text/javascript"my src="jquery.js">

<link rel="stylesheet" type="text/css" href="mystyle.css">

No comments:

Post a Comment

Thank You For Comment