Created
April 28, 2023 14:32
-
-
Save aslamatwebdevstudios/01b578b3ac4733154bb04b497fff5206 to your computer and use it in GitHub Desktop.
Enqueue styles in Plugin
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 my_plugin_enqueue() { | |
$file_path = plugin_dir_path( __FILE__ ) . 'css/styles.css'; | |
$version = filemtime( $file_path ); | |
wp_register_style( | |
'my_plugin_main_css', | |
plugins_url( '/css/styles.css', __FILE__ ), | |
array(), | |
$version | |
); | |
wp_enqueue_style( 'my_plugin_main_css' ); | |
} | |
add_action( 'wp_enqueue_scripts', 'my_plugin_enqueue' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment