我为客户提供了一个小型多站点网络的超级运营商。所有网站都具有相同的名称,因此组织所有网站会产生一些混乱:
更改每个网站的标题不是一个选项(因为一些SEO优化和熟悉)。
我只找到了如何将所有仪表板徽标更改为另一个(通过functions.php中的wp_enqueue_style)的指南,但在使用多站点时没有任何内容。有什么想法吗?
答案 0 :(得分:0)
这可能与CSS有关。
尝试定位每个类,或者如果它们都具有相同的类,则可以使用:nth-child
运算符。
.your-class:nth-child(1){
// CSS to change logo
}
.your-class:nth-child(2){
// CSS to change logo
}
.your-class:nth-child(3){
// CSS to change logo
}
下面是一些用于将css插入管理区域的代码。将此代码放在functions.php
中。
我在常规网站上进行过测试,但是它没有在像你这样的多站点上进行测试。
希望它有效,祝你好运:)。
function custom_admin_logo() {
echo '
<style type="text/css">
#wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon:before {
background-image: url(' . get_bloginfo('stylesheet_directory') . '/images/your-logo.jpg) !important;
background-position: 0 0;
color:rgba(0, 0, 0, 0);
background-size: cover;
}
#wpadminbar #wp-admin-bar-wp-logo.hover > .ab-item .ab-icon {
background-position: 0 0;
}
</style>
';
}
add_action('wp_before_admin_bar_render', 'custom_admin_logo');