How to add js and css in wordpress?

/**
 * Proper way to enqueue scripts and styles
 */
function theme_name_scripts() {
	wp_enqueue_style( 'style-name', get_stylesheet_uri() );
	wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true );
}

add_action( 'wp_enqueue_scripts', 'theme_name_scripts' );
Advertisements

5 thoughts on “How to add js and css in wordpress?

  1. Hello everyone .i use seetdate theme in wp.this theme allready installed buddypress plugin .here i want to customize something. in buddypress plugin’s member-header.php file code i want to run my own created template file so i paste the code in this file but the code doesn’t work .so my way to run the code is perfect way or not ? plz ans me asap

    Like

  2. @patelsaurabh this is not helpline brother..if you have someproblem or issue of this post.. so you can post here..
    Thanks.

    Like

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