Created
March 31, 2015 17:27
-
-
Save verticalgrain/a72b66a43cbbfc2072b4 to your computer and use it in GitHub Desktop.
Wordpress dashboard widget template function
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
| <?php | |
| /** | |
| * Add a widget to the dashboard. | |
| * | |
| * This function is hooked into the 'wp_dashboard_setup' action below. | |
| */ | |
| function example_add_dashboard_widgets() { | |
| wp_add_dashboard_widget( | |
| 'dashboard_links', // Widget slug. | |
| 'Dashboard Links', // Title. | |
| 'dashboard_links_function' // Display function. | |
| ); | |
| } | |
| add_action( 'wp_dashboard_setup', 'example_add_dashboard_widgets' ); | |
| /** | |
| * Create the function to output the contents of our Dashboard Widget. | |
| */ | |
| function dashboard_links_function() { | |
| echo '<ul class="dashboard-links">'; | |
| echo '<li><div class="dashboard-link-inner"><a href="' . get_bloginfo('url') . '/wp-admin/edit.php?post_type=page">Edit pages</a></div></li>'; | |
| echo '<li><div class="dashboard-link-inner"><a href="' . get_bloginfo('url') . '/wp-admin/post-new.php?post_type=page">New page</a></div></li>'; | |
| echo '<li><div class="dashboard-link-inner"><a href="' . get_bloginfo('url') . '/wp-admin/admin.php?page=site-settings">Global settings</a></div></li>'; | |
| echo '<li><div class="dashboard-link-inner"><a href="' . get_bloginfo('url') . '/wp-admin/nav-menus.php">Update menus</a></div></li>'; | |
| echo '<li><div class="dashboard-link-inner"><a href="' . get_bloginfo('url') . '/wp-admin/users.php">Users</a></div></li>'; | |
| echo '<li><div class="dashboard-link-inner"><a href="' . get_bloginfo('url') . '/wp-admin/admin.php?page=backwpup">Users</a></div></li>'; | |
| echo '</ul>'; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment