function class doesnt work

by Murat Deniz   Last Updated July 12, 2019 00:08 AM - source

i added a menu to admin bar menu but it's style doesnt work;it looks like has default style

 <style>

     .my_menu_item_class{
        color:red;
         background: yellow;
    }  
     </style>
 <?php   
    add_action('admin_bar_menu', 'add_toolbar_items', 100);
    function add_toolbar_items($admin_bar){
        $admin_bar->add_menu( array(
            'id'    => 'my-item',
            'title' => 'My Item',
            'href'  => '#',
            'meta'  => array(
                'title' => __('My Item'),            
            ),
        ));
        $admin_bar->add_menu( array(
            'id'    => 'my-sub-item',
            'parent' => 'my-item',
            'title' => 'My Sub Menu Item',
            'href'  => '#',
            'meta'  => array(
                'title' => __('My Sub Menu Item'),
                'target' => '_blank',
                'class' => 'my_menu_item_class'
            ),
        ));
        $admin_bar->add_menu( array(
            'id'    => 'my-second-sub-item',
            'parent' => 'my-item',
            'title' => 'My Second Sub Menu Item',
            'href'  => '#',
            'meta'  => array(
                'title' => __('My Second Sub Menu Item'),
                'target' => '_blank',
                'class' => 'my_menu_item_class'
            ),
        ));
    }

?>
Tags : functions css


Related Questions



List all post title in category using functions.php

Updated April 04, 2015 19:03 PM

List all post title in category using functions.php

Updated April 05, 2015 18:03 PM


how to use wordpress-as-a-pay-for-access-system

Updated May 29, 2015 03:03 AM