Wp Dashboard

How to add a section at wordpress admin dashboard

When we install a new fresh wordpress and login to its admin panel, we are several options about the wordpress. Also when we start working further and adding few plugins to add more functionality to the website. After sometime we have observed that few new sections explaining the plugins stats adds up to our dashboard. These sections or we can say widgets are added by plugins to show their information at the dashboard.

In the same manner, we can also show our important information at the dashboard which we want to highlight. We can add our custom widgets and able to show that on wordpress dashboard. Below is a example widget code :

1
2
3
4
5
6
7
8
9
10
11
12
13
function wptricks24_widget_content() {
    // Put all the details in between echo quotes
    echo "<ul>
    <li>Owner Name: Sunil Chaudhary</li>
    <li>Website: http://www.wptricks24.com/</li>
    <li>Profession: Front-End/Wordpress Developer.</li>
    <li>Interests: Playing Volley ball, cricket and TT</li>
    </ul>";
}
function wptricks24_add_dashboard_widgets() {
    wp_add_dashboard_widget('owner_dashboard_widget', 'Owner Information', 'wptricks24_widget_content');
}
add_action('wp_dashboard_setup', 'wptricks24_add_dashboard_widgets' );

Add this code to your functions.php file of your current theme. After adding this code, just login to your wordpress admin and go to dashboard, your widget will show there just like the below image.

 

Now, above is only a example widget which is just showing the information of the Owner of this blog. You can customize this information easily, you are able to add your information in that section. Above code is just using the wordpress dashboard API.
dashboard

How To move this section or widget to the top:

The widget create by the above code will show at the bottom of the admin dashboard and we want to show it at the top of our dashboard. It is quite simple, just pick the widget with your mouse pointer, drag to your desired place and then drop it.

Now you are able to add your new widget at your desired place in wordpress dashboard. This widget code support full customization, just put your details inside the function “wptricks24_widget_content” between the echo quotes. This will show your content easily.

Mostakim Hossen

I am Mostakim Hossain, a Web designer and developer, 23 years of age. I have been working as a freelance (upwork) for almost 2 years now and I will be glad in helping you create your next awesome project.

I have created lots of public and private websites(some shown below) and always looking for more work to learn from. I am using PHP as my primary programming language. You can see my skill set beside this text.

I am a person who is willing to learn and adapts quickly. I am keen to design and security. I believe in the core principles of Open Source and support it. I have a minimalist approach to design and usability. Simplicity is beauty they say.
Masters of Accountancy : Asian University of Bangladesh
I’m here to answer any questions you might have about our products and services. Feel free to contact me using any of the following methods:

Email : support@smarterdevs.com

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe
SUBSCRIBE NOW

Coupon : happynewyear

60% OFF

Stay updated with all latest updates,upcoming plugins & much more.
WordPress Themes
Search