wordpress php – add html to dashboard menu

I’m building a wordpress theme and within the theme is a dashboard theme. I want to add a logo and some text above the first menu item in the wordpress admin dashboard menu. Without editing any core wordpress files I figured the best way to do this is to insert it using jquery.

Here is my current code – the php adds the jquery code to the head of the admin area:

Read More
add_action('admin_head', 'dashboard_menu_logo');

function dashboard_menu_logo() {
  echo '<script type="javascript/text">

jQuery(document).ready(function(){
    $("#adminmenu").html("<div class="hello">Hello</div>");
    });

</script>';
}

I think the issue is that the page is loading this script after it has populated everything (but I might be wrong) – either way it’s not doing anything. Can anyone help with a solution to add html to the admin menu

Related posts

Leave a Reply

1 comment

  1. You can use admin_menu action. Title area supported html tags.

    add_action('admin_menu', 'createMenu');
    function createMenu() {
        add_menu_page('Page Title', '<strong style="color:lightcoral">YOUR HTML CODE</strong>', 'administrator', 'click-action', 'your_new_menu', 'your-favicon-path', 61);
    }