Skip to content

Instantly share code, notes, and snippets.

@apatton-cnet
Last active December 18, 2015 09:09
Show Gist options
  • Save apatton-cnet/5759832 to your computer and use it in GitHub Desktop.
Save apatton-cnet/5759832 to your computer and use it in GitHub Desktop.
enqueue admin stylesheet on wordpress backend
<?php
function ebs_seo_cp_admin_init() {
wp_register_style('ebs_seo_cp_admin_stylesheet', plugins_url('admin-stylesheet.css', __FILE__));
}
add_action( 'admin_init', 'ebs_seo_cp_admin_init' );
function ebs_seo_cp_admin_enqueue($hook) {
$pages_array = array(
'ebs_seo_cp_menu',
'ebs_seo_cp_menu_view_options',
'ebs_seo_cp_menu_contact_options',
'ebs_seo_cp_menu_business_options',
'ebs_seo_cp_menu_google_maps_options',
'ebs_seo_cp_menu_social_media_options'
);
if (is_admin() && in_array($_GET['page'], $pages_array)) {
wp_enqueue_style('ebs_seo_cp_admin_stylesheet');
}
}
add_action('admin_enqueue_scripts', 'ebs_seo_cp_admin_enqueue');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment