Registering scripts and styles in wordpress



<?php

// create custom function and then pin it to next add_action()

function add_scripts() {

if(!is_admin()) {
// for css
wp_enqueue_style('css_select', get_template_directory_uri() ."/files/filename.css");

// for javascript

wp_enqueue_script('jquery_check', get_template_directory_uri() ."/files/filename.js");


}

}

//registering the above function in the following line

add_action('wp_enqueue_scripts', 'add_scripts');

?>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s