<div class="example" <?php if($admin == 1){ echo 'style="display: block;"';} else{ echo 'style="display: none;"'; ?>> CONTENT </div>
<?php
if(current_user_can( 'manage_options' ))
{
... admin stuff....
}
?>
function admin_stylesheet()
{
if (current_user_can( 'manage_options' )) {
wp_register_style('admin_css', get_template_directory_uri() . '/admin.css', array(), '1.0', 'all');
wp_enqueue_style('admin_css');
}
}
add_action('wp_enqueue_scripts', 'admin_stylesheet');
<?php
if ( is_user_logged_in() && current_user_can( 'manage_options' ) ) {
?>
<style>
.example {
display: block;
}
</style>
<?php
}
?>
add_filter('body_class','my_class_names');
function my_class_names($classes) {
if (is_user_logged_in() && current_user_can('manage_options')) {
$classes[] = 'admin-user';
}
return $classes;
}
.admin-user .example {
display: block;
}
function add_custom_stylesheets_admin() {
$handle = '<HANDLE>';
$src = '<PATH_TO_STYLESHEET>';
wp_register_script($handle, $src);
wp_enqueue_style($handle, $src, array(), null, null);
}
add_action('admin_head', 'add_custom_stylesheets_admin');