Custom Content on WordPress Dashboard

I’m trying to figure out the best way about going and adding custom content to my wordpress dashboard that will be defined in my admin panel.

So essentially I’ll have my admin account be able to set certain settings, and the other users (subscribers, editors, etc…) will see the custom dashboard when they login (the admin will see it as well).

Read More

So far I’ve cleared the entire dashboard, and know how to add a widget to it but I’m trying to add custom html instead (without the widget box).

Any suggestions/ideas? I’d love some help with this one, thanks!

Related posts

Leave a Reply

2 comments

  1. Perhaps you can simply add a custom function in your functions.php with your specific HTML content like this:

    /* add content */
    function customContent() {
      echo '<div><p>Custom Lorem Ipsum Content</p></div>';
    } 
    
    /* add action */
    add_action('load-index.php', 'customContent');
    

    In this vein you are showing some customContent under the Admin Bar within the Dashboard to all Users. But now it will be quite a bit of work to do the styling. So why not use the normal customDashboardWidgets with its functionality and just reset the styling?

    /* add content */   
    function customContent() {
      echo '<div><p>Custom Lorem Ipsum Content</p></div>';
    }
    
    /* add widget */
    function add_customDashboardWidget() {
      wp_add_dashboard_widget('wp_dashboard_widget', 'Custom Content', 'customContent');
    }
    
    /* add action */
    add_action('wp_dashboard_setup', 'add_customDashboardWidget' );
    

    And finally you can do some styling:

    <style type="text/css">
    .postbox,
    .postbox div.handlediv,
    .postbox h3.hndle {
      background: none;
      border: none;                       
    }                       
    </style>
    

    Note: Make sure to close/open the PHP tags before/after the CSS correctly if inserting the styles within your functions.php

  2. The below function will remove some unwanted boxes from your dashboard. Also It adds a custom box called “Help and Support”. You can add any html to this section.

    Add the below code to your functions.php

    //Remove unwanted boxes and Add a custom widget called 'Help and Support
    function my_custom_dashboard_widgets() {
       global $wp_meta_boxes;
       unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
       unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
       unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
       unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
       wp_add_dashboard_widget('custom_help_widget', 'Themes: Help and Support', 'custom_dashboard_help');
    }
    function custom_dashboard_help() {
        echo '<p>Support: <a href="#" target="_blank">Support Forum</a><i> (For members only).</i><p><p>Wants to customize your theme by our WordPress Experts? <a href="#" target="_blank">Customize my theme</a> <i>(Our wp Experts will do it for you!)</i></p>';
    }
    

    Hope this will helps you.