Skip to content

Instantly share code, notes, and snippets.

@aslamatwebdevstudios
Created April 28, 2023 14:52
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/e5f0253868e5bb7dca55d66a71bdc525 to your computer and use it in GitHub Desktop.
Save aslamatwebdevstudios/e5f0253868e5bb7dca55d66a71bdc525 to your computer and use it in GitHub Desktop.
Enqueue Admin Styles
<?php
function my_plugin_enqueue($hook) {
if ( 'edit.php' === $hook ) {
$file_path = plugin_dir_path( __FILE__ ) . 'css/edit_page_styles.css';
$version = filemtime( $file_path );
wp_register_style(
'my_plugin_main_css',
plugins_url( '/css/edit_page_styles.css', __FILE__ ),
array(),
$version
);
wp_enqueue_style( 'my_plugin_main_css' );
}
}
add_action( 'admin_enqueue_scripts', 'my_plugin_enqueue' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment