Your cart is currently empty!
To enqueue a style in WordPress functions.php
file, you can use the wp_enqueue_style
function, which adds the stylesheet to the queue of stylesheets that will be loaded on the page. Here’s an example:
function mytheme_enqueue_styles() { wp_enqueue_style( 'mytheme-style', get_stylesheet_uri() ); } add_action( 'wp_enqueue_scripts', 'mytheme_enqueue_styles' );
In this example, we’re using wp_enqueue_style
to add the stylesheet with the handle 'mytheme-style'
. We’re also using the get_stylesheet_uri
function to get the URI for the current theme’s stylesheet.
The add_action
function is used to specify when the mytheme_enqueue_styles
function should be called. In this case, we’re using the 'wp_enqueue_scripts'
action, which is called on the front-end when scripts and styles are enqueued.
You can also specify additional arguments to wp_enqueue_style
, such as the path to the stylesheet file, dependencies, version number, and media type. Here’s an example that uses some of these options:
function mytheme_enqueue_styles() { wp_enqueue_style( 'mytheme-style', get_template_directory_uri() . '/style.css', array(), '1.0.0', 'all' ); } add_action( 'wp_enqueue_scripts', 'mytheme_enqueue_styles' );
In this example, we’re enqueuing a stylesheet with the handle 'mytheme-style'
, located in the theme’s directory at style.css
. We’re not specifying any dependencies, and we’re using version number 1.0.0
. We’re also specifying the media type as 'all'
, which means the stylesheet will be used for all devices.
Comments
-
Insertcart Custom WooCommerce Checkbox Ultimate
Original price was: $ 39.00.$ 19.00Current price is: $ 19.00. -
Android App for Your Website
Original price was: $ 49.00.$ 35.00Current price is: $ 35.00. -
Abnomize Pro
Original price was: $ 30.00.$ 24.00Current price is: $ 24.00. -
Medical Portfolio Pro
Original price was: $ 31.00.$ 24.00Current price is: $ 24.00. -
Your Website Set Up + Boost
Original price was: $ 49.00.$ 41.00Current price is: $ 41.00.
Latest Posts
- How to Use AWS SES Email from Localhost or Website: Complete Configuration in PHP
- How to Upload Images and PDFs in Android Apps Using Retrofit
- [Fix] File Permission Issue in Apache Website WordPress Not Writable to 775
- Best PHP ini Settings for WordPress & WooCommerce: Official Recommendations
- Script to Get Users System or Browser Data When Link Open Grab Using PHP & JavaScript
Leave a Reply