Created
July 31, 2019 23:35
-
-
Save SalmanRavoof/e700e8a6458b27e89191dece3ca47ca1 to your computer and use it in GitHub Desktop.
Add a custom widget to your WordPress dashboard.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add a new widget to the dashboard using a custom function | |
function wpmudev_add_dashboard_widgets() { | |
wp_add_dashboard_widget( | |
'wpmudev_dashboard_widget', // Widget slug | |
'My Custom Dashboard Widget', // Widget title | |
'wpmudev_new_dashboard_widget_function' // Function name to display the widget | |
); | |
} | |
// Register the new dashboard widget with the 'wp_dashboard_setup' action | |
add_action( 'wp_dashboard_setup', 'wpmudev_add_dashboard_widgets' ); | |
// Initialize the function to output the contents of your new dashboard widget | |
function wpmudev_new_dashboard_widget_function() { | |
echo "Hello from WPMU DEV. The world is your oyster and I'm the pearl! Edit me with HTML or PHP to create the widget of your dreams. "; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment