スニペット/WordPress 管理画面
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | // CSS変更 function post_output_css() { $pt = get_post_type(); if($pt == 'post') { ?> <style type="text/css"> div#categorydiv { height: auto; } div#category-all { max-height: none; height: auto; } .fixed .column-categories { width: 30%; } </style> <?php } } add_action('admin_head', 'post_output_css'); // 管理画面 favicon function admin_favicon() { echo '<link rel="icon" type="image/vnd.microsoft.icon" href="'. get_stylesheet_directory_uri() . '/images/favicon.png">'; } add_action('admin_head', 'admin_favicon'); // ログイン画面背景 function custom_login() { ?> <style> .login {background: #f1f1f1;} </style> <?php } add_action('login_enqueue_scripts', 'custom_login'); // ログイン画面ロゴ function custom_login_logo() { ?> <style> .login #login h1 a { width: 144px; height: 144px; background: url(<?php echo get_stylesheet_directory_uri(); ?>/images/logo_admin.png) no-repeat; } </style> <?php } add_action('login_enqueue_scripts', 'custom_login_logo'); // 管理画面の投稿一覧にアイキャッチ function customize_admin_manage_posts_columns($columns) { $columns['thumbnail'] = __('Thumbnail'); return $columns; } function customize_admin_add_column($column_name, $post_id) { if ('thumbnail' == $column_name) { $thum = get_the_post_thumbnail ($post_id, 'small', array('style'=>'width:120px;height:auto;') ); } if (isset($thum) && $thum) { echo $thum; } } function customize_admin_css_list() { echo '<style TYPE="text/css">.column-thumbnail{width:120px;}</style>'; } add_filter ('manage_posts_columns', 'customize_admin_manage_posts_columns'); //カラムの挿入 add_action ('manage_posts_custom_column', 'customize_admin_add_column', 10, 2); //サムネイルの挿入 add_action ('admin_print_styles', 'customize_admin_css_list', 21); //カラム幅のスタイル調整 // 投稿一覧のコラム順序 function sort_column($columns){ $columns = array( 'cb' => '<input type="checkbox">', 'thumbnail' => 'サムネイル', 'title' => 'タイトル', 'categories' => 'カテゴリー', 'date' => '日時', 'author' => '作成者', 'comments' => 'コメント' ); return $columns; } add_filter( 'manage_posts_columns', 'sort_column'); |
コメントを投稿する