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 main stylesheet into theme from 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 unic 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 -

Add 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.