[英]Wordpress - Add a new Admin Color Scheme using functions.php
在 Wordpress UI 的“配置文件”頁面 (../wp-admin/profile.php) 上,您可以選擇八種默認的管理配色方案作為選項:
我找到了這些方案的 CSS 是在哪里創建的 (../wp-admin/css/colors/) 並使用 CSS 制作了我自己的文件夾以匹配。
首先,我什至無法在“個人資料”頁面上顯示我的配色方案,因此我可以對其進行測試。 在 ../wp-admin/profile.php 就是這樣:
define('IS_PROFILE_PAGE', true);
/** Load User Editing Page */
require_once( dirname( __FILE__ ) . '/user-edit.php' );
在 ../wp-admin/user-edit.php 中,這是吐出配色方案的部分:
<?php if ( count($_wp_admin_css_colors) > 1 && has_action('admin_color_scheme_picker') ) : ?>
<tr class="user-admin-color-wrap">
<th scope="row"><?php _e('Admin Color Scheme')?></th>
<td><?php
/**
* Fires in the 'Admin Color Scheme' section of the user editing screen.
*
* The section is only enabled if a callback is hooked to the action,
* and if there is more than one defined color scheme for the admin.
*
* @since 3.0.0
* @since 3.8.1 Added `$user_id` parameter.
*
* @param int $user_id The user ID.
*/
do_action( 'admin_color_scheme_picker', $user_id );
?></td>
</tr>
<?php
endif; // $_wp_admin_css_colors
所以我的問題是:
讓我知道是否需要添加更多詳細信息,感謝您的幫助!
看看這篇文章,它可能對你有幫助: https : //www.orionorigin.com/tutorials-and-snippets/define-wordpress-color-scheme-set-default-users/
add_filter( 'get_user_option_admin_color', function( $color_scheme ) {
$color_scheme = 'your_color_sheme_name';
return $color_scheme;
}, 5 );
對於任何想知道的人:我找到了答案! 感謝@Manas Khandelwal 的幫助,我能夠找到一個為我生成 CSS 文件的工作站點。 它是一個很好的起點,我從它開始的基本文件中對其進行了編輯。
這是網站,我強烈推薦它: https : //wpadmincolors.com/
只需按照說明將其放入您的主題即可。 謝謝你們!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.