Get WordPress style sheet URL

If you want to include your style URL in your theme where the description of the theme and author is defined then you have to import the style URL in your theme and if you have imported all the related style URL in the theme defining stylesheet then you must have to import the stylesheet. Now in this post WordPress get style URL we will discuss how to import the main stylesheet into the theme from the header or from functions.php

Import main stylesheet into theme using header

The code for style sheet URL is get_stylesheet_uri() and have to print the code on a link tag with relation stylesheet.
Example:

<link href="<?php echo get_stylesheet_uri(); ?>" rel="stylesheet" />

Import main stylesheet into theme using header

Have to use wp_enqueue_style to include the main stylesheet from function.php file and you need to place the code inside your theme function file or in function.php file, here the first parameter is key is must be unique for your theme and the second one is the link of the style.
Example:

<?php wp_enqueue_style( 'codemystery-style', get_stylesheet_uri() ); ?>

I hope the post WordPress get style URL helped you, please provide your comment to make the site better and more useful.

Thanks for Reading

Share The Post On -