Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aslamatwebdevstudios/01b578b3ac4733154bb04b497fff5206 to your computer and use it in GitHub Desktop.
Save aslamatwebdevstudios/01b578b3ac4733154bb04b497fff5206 to your computer and use it in GitHub Desktop.
Enqueue styles in Plugin
<?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