drvvvuyia15070493 2019-06-17 10:56
浏览 90
已采纳

如何在functions.php中设置类的样式

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

add_action('admin_menu',
    'wpso_custom_links_admin_menu');

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

  • 写回答

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;}
      </style>';
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 设计一个温度闭环控制系统
  • ¥100 关于加载卡的问题有能知道这个要怎么处理吗?
  • ¥100 rtmpose姿态评估
  • ¥15 java 通过反射找路径下的类,打包后就找不到
  • ¥15 通联支付网上收银统一下单接口
  • ¥15 angular有偿编写,
  • ¥15 centos7系统下abinit安装时make出错
  • ¥15 hbuildex运行微信小程序报错
  • ¥15 关于#python#的问题:我知道这个问题对你们来说肯定so easy
  • ¥15 wpf datagrid如何实现多层表头