Skip to content

Instantly share code, notes, and snippets.

@morktron
Last active August 29, 2015 13:56
Show Gist options
  • Save morktron/9221287 to your computer and use it in GitHub Desktop.
Save morktron/9221287 to your computer and use it in GitHub Desktop.
Add css to Wordpress admin via child theme functions.php
<?php
// hide field table from all pages in admin except 'company profile'
add_action('admin_enqueue_scripts', 'my_hide_field_table_func');
function my_hide_field_table_func(){
$arr = array(74);
if(get_post_type() == 'page' && !in_array(get_the_ID(), $arr))
{
wp_enqueue_style( 'hide_field_table', bloginfo('stylesheet_directory').'/wp-content/themes/child-theme-name/custom-admin.css');
}
}
?>
@morktron
Copy link
Author

in this case the custom-admin.css file is only loaded for Wordpress 'pages' unless the id of the page is 74

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment