Created
December 28, 2020 11:03
-
-
Save vanpariyar/1f5a562de1e992cf41082af1583fa9b9 to your computer and use it in GitHub Desktop.
This code for enqueue JavaScript and CSS in WordPress Whole folder no need to separate enqueue the Files.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function enqueue_my_scripts(){ | |
foreach( glob( get_stylesheet_directory(). '/js/*.js' ) as $file ) { | |
$filename = substr($file, strrpos($file, '/') + 1); | |
wp_enqueue_script( $filename, get_template_directory_uri().'/js/'.$filename); | |
} | |
foreach( glob( get_stylesheet_directory(). '/css/*.css' ) as $file { | |
$filename = substr($file, strrpos($file, '/') + 1); | |
wp_enqueue_style( $filename, get_template_directory_uri().'/css/'.$filename); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment