aidaghazaryan aidaghazaryan - 1 year ago 110
jQuery Question

how to change sidebar menu content dynamically - wordpress?

I have unique design of wordpress backend and need to implement it. How can I add my own menu items there(see first attached image)? I know how to remove existing menus, but except removing I need to add my own menus. Is there a dynamic way with php to do it? (see image example here)

I tried to add my custom menus with jquery append() function but it is really bad solution. Any ideas please?

Wordpress Admin Side Menu

Answer Source

Add custom logo with user name in admin menu.

Demo link image :

Add in functions file

add_action('admin_menu', 'codyfly_admin_menu');
function codyfly_admin_menu() {
    global $menu;
    global $current_user;
    $url = '';
    $url1 = '';
    $username = '';
    if ( is_user_logged_in() ) { 
        $username = $current_user->user_login;
    $menu[0] = array( __(''), 'read', $url, 'my-logo', 'my-logo');
    $menu[1] = array( __($username), 'read', $url1, 'my-logo1', 'my-logo1');

add_action('admin_head', 'codyfly_admin_style');

function codyfly_admin_style() {
    echo '<link rel="stylesheet" href="' . get_template_directory_uri() . '/css/style-admin.css" type="text/css" media="all" />';

Add in style

    display: block;
    background: url( no-repeat center center;
    background-size: 140px 40px;
    width: 140px;
    height: 40px;
    margin: 0 auto;
    padding: 10px 5px;

    font-size: 14px;
    font-weight: 400;
    line-height: 18px;
     background: url( no-repeat;
    background-position: left center;
    background-size: 50px 40px;
#adminmenu .wp-menu-name{
    padding-left: 60px;
#adminmenu a.shomtek-logo div.wp-menu-name {
    display: none;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download