HOME > WordPress> function.php

管理画面に任意のcss

/*管理画面に任意のcssファイルを読み込む*/
function wp_custom_admin_css() {
    echo “\n” . ‘<link href=”‘ .get_bloginfo(‘template_directory’). ‘/css/wp-admin.css’ . ‘” rel=”stylesheet” type=”text/css” />’ . “\n”;
if (!current_user_can(‘administrator’)) { //admin以外
    echo “\n” . ‘<link href=”‘ .get_bloginfo(‘template_directory’). ‘/css/user.css’ . ‘” rel=”stylesheet” type=”text/css” />’ . “\n”;
    }else{
        echo “\n” . ‘<link href=”‘ .get_bloginfo(‘template_directory’). ‘/css/miyazaki.css’ . ‘” rel=”stylesheet” type=”text/css” />’ . “\n”;
    $screen = get_current_screen();
    
//スケジュール入力ページに
if($screen -> post_type ==’event’) { ?>
  <script type=”text/javascript”>
        jQuery(function(){
            jQuery(‘#eo-start-datetime-label’).text(‘開始日時’);
            jQuery(‘#eo-end-datetime-label’).text(‘終了日時’);
            jQuery(‘.eo-venue-combobox-select’).hide();
        })
        </script>
    <?php } 
  }
add_action(‘admin_head’, ‘wp_custom_admin_css’, 100);