- Can we load multiple style-sheets using one handle?
- git add .

To add any css to our theme we have to enqueue it in the functions.php, for that we can use following code
wp_enqueue_style( 'style', get_stylesheet_uri() );
This will enqueue the main style.css , you can enqueue other scripts too…
wp_enqueue_style('test-style',get_stylesheet_directory_uri() . '/gg.css' ) ;
Below given are the arguments for this function :- (got it from the core code)
function wp_enqueue_style(
$handle,
$src = '',
$deps = array(),
$ver = false,
$media = 'all' )
- $handle
- String unique name for the stylesheet
- $src
- The source link for the stylesheet
- $deps
- array of other handles on which this depends
- $ver
- version for stylesheet, if not added WordPress version is used
- $media
- the media for which stylesheet has been defined.
Is it possible to enqueue multiple scripts using same handle?
- let’s try
I have this two css files in my theme and the index.php



This is my code to enquque the stylesheets
function enqueue_multi()
{
wp_enqueue_style('test-style',
get_stylesheet_directory_uri() . '/gg.css') ;
wp_enqueue_style('test-style',
get_stylesheet_directory_uri() . '/ff.css') ;
}
add_action('wp_enqueue_scripts', 'enqueue_multi');
This is the output coming:-

**The script enqueue first is not overwritten by the second one**
Using “git add .” :- 
It is not a good practise to use git add . when adding the changes to the commit, it will add all the changes at the same time even the ones not intended to be pushed.
Always add the files one by one
Leave a Reply