living in the question...

Friday, November 4, 2011

wordpress: How to make your own wordpress Dashboard Widget

By on 10:59 AM
Wordpress is one of the leading open source php CMS. It is very simple and highly customizable. Within the dashboard of Wordpress the whole cms can be customized very easily. Different themes can very easily be applied to your website through the Wordpress dashboard. Advance user can develop their own theme and put the files in \site\wp-content\themes folder to apply it to the website from the Wordpress dashboard. http://www.wordpress.org provides a very comprehensive documentation on Wordpress development and implementation.

In this article I will just show you how easily you can make your own custom Wordpress Dashboard widgets. For the purpose you just need to edit only one file from the theme base folder and that is functions.php. The file can also be edited from the wordpress dashboard editor sub-menu under the appearance.
For the Custom Dashboard Widget you just need to include the following functions into your functions.php file and thats all...

//What your Widget Does
function yourDashboarFunction() {
    // This is the space where you can do anything you want to include in the widget.
    echo "For now just say Hello World";
}

//Creat your hook
function yourDashboardwidget() {

 wp_add_dashboard_widget('YourWidget', 'Your Widget Title', 'yourDashboarFunction');
}

//hook your widget
add_action('wp_dashboard_setup', 'yourDashboardwidget' );
Now go to your Wordpress Dashboard and there it is your widget among the Dashboard widgets. You can Do complex things inside yourDashboardFunction().

1 comments: