2019-06-17 10:56
浏览 75


[![enter image description here][1]][1]I added I some classes to my functions.php like so:


function wpso_custom_links_admin_menu() {
        global $submenu;
        $submenu['index.php'][] = array('Link One', 'read',
            'https://www.example.com/', '', 'jobs-dashboard');
        $submenu['index.php'][] = array('Link Two', 'read',
            'https://asdf.com/', '', 'events-dashboard

Then I added css:

. jobs-dashboard {background-color: green;}

Didn't work. Why not? enter image description here

[1]: https://i.stack.imgur.com/IEdMC.jpgenter image description hereenter image description here

图片转代码服务由CSDN问答提供 功能建议

[![在此处输入图像说明] [1]] [1]我在函数中添加了一些类。 像这样的PHP:

function wpso_custom_links_admin_menu(){
 global $ submenu; 
 $ submenu [  'index.php'] [] =数组('Link One','read',
 $ submenu [  'index.php'] [] =数组('Link Two','read',


 。  jobs-dashboard {background-color:green;} 

无效。 为什么不?

[1]: https://i.stack.imgur.com/IEdMC.jpg

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • doujishan2247 2019-06-17 21:01

    It looks like you are using your themes additional CSS option, which is typically for front end CSS changes.

    To add CSS to the admin area you can use the admin_head hook in your functions.php.

    add_action('admin_head', 'my_custom_css');
    function my_custom_css() {
      echo '<style>
        .jobs-dashboard {background-color: green;}
    点赞 打赏 评论
  • duan97689 2019-06-17 21:38

    I think it doesn't work because you put a space in you class:

    . jobs-dashboard {background-color: green;}
    点赞 打赏 评论

相关推荐 更多相似问题