Get path to the root folder to add stylesheet or script

get_stylesheet_directory_uri()

Here is the reference link: https://developer.wordpress.org/reference/functions/get_stylesheet_directory_uri/

A sample code:

function disa_scripts() {
	wp_enqueue_style( 'indexaf6c', get_stylesheet_directory_uri() . '/assfolder/assets/css/indexaf6c.css' );

	wp_enqueue_script( 'disa-navigation', get_template_directory_uri() . '/js/navigation.js', array(), _S_VERSION, true );
	wp_enqueue_script( 'rocket-loader', get_template_directory_uri() . '/assfolder/assets/js/rocket-loader.min.js', array(), _S_VERSION, true );
	}
add_action( 'wp_enqueue_scripts', 'disa_scripts' );

You need to put this code in your function.php file

Share it in your network:

Share on facebook
Share on twitter
Share on linkedin
Share on whatsapp

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

small_c_popup.png

Congratulations!

You have successfully subscribed to my email list. Now you will be recieving latest wordpress tips and tricks directly in your mail box.

Don’t worry! I won’t spam you

Stay Home! Because situation outside is