Cách tùy chỉnh CSS cho trang Admin Wordpress | VN-Zoom | Cộng đồng Chia Sẻ Kiến Thức Công Nghệ và Phần Mềm Máy Tính

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We need money to operate the site, and almost all of it comes from our online advertising.

If possible, please support us by clicking on the advertisements.

Please add vn-z.vn to your ad blocking whitelist or disable your adblocking software.

×

Cách tùy chỉnh CSS cho trang Admin Wordpress

rs_lyly2009

Moderator
Thành viên BQT
Nay lang thang trên mấy blog Wordpress thì tình cờ phát hiện bài viết ngắn này :D

Cách để các bạn có thể thay đổi css cho một số thành phần trong trang Admin Wordpress

Cách 1.
Chỉ cần thêm dòng này vào file functions.php (nhớ thêm vào Child Theme để khi update không bị mất nhá).

Mã:
add_action('admin_head', 'my_custom_fonts');

function my_custom_fonts() {
  echo '<style>
    body, td, textarea, input, select {
      font-family: "Lucida Grande";
      font-size: 12px;
    }
  </style>';
}

;)) Nhìn vào đây chắc bạn sẽ hiểu được sửa thế nào rồi :D

Cách 2.
B1. Tạo ra 1 file CSS với tên admin.css, nội dung thì tùy bạn thôi, ví dụ:
Mã:
.wp-admin .comment pre {
  background: pink; /* they forgot the language! */
  padding: 6px 10px;
  font-size: 16px;
  border: 1px solid #-censor-;
}

.wp-admin .comment pre[class] {
  background: #fff; /* language (likely) there */
}

B2. Thêm đoạn code này vào functions.php
Mã:
// Update CSS within in Admin
function admin_style() {
  wp_enqueue_style('admin-styles', get_template_directory_uri().'/admin.css');
}
add_action('admin_enqueue_scripts', 'admin_style');

trong đó /admin.css là url đến file css. Nếu bạn gặp khó khăn phần này thì cứ đặt nó ngang hàng file functions :D
À, nhớ xài Plugin này nếu bạn lo lắng việc sửa file functions bị lỗi và không truy cập được website nhé: https://wordpress.org/plugins/code-snippets/

Bài viết được dịch từ 2 nguồn sau:
Mã:
https://css-tricks.com/snippets/wordpress/apply-custom-css-to-admin-area/

Mã:
https://davidwalsh.name/add-custom-css-wordpress-admin

Tham khảo thêm
Mã:
https://codex.wordpress.org/Creating_Admin_Themes
 
Sửa lần cuối:


Top