forked from TomodomoCo/wp-custom-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard.php
More file actions
54 lines (48 loc) · 1.53 KB
/
Copy pathdashboard.php
File metadata and controls
54 lines (48 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* function my_remove_dashboard_widgets
* Unset dashboard widgets
*
* @since 1.0
*/
function my_remove_dashboard_widgets() {
// Left column
remove_meta_box( 'dashboard_right_now', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_plugins', 'dashboard', 'normal' );
// Right column
remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' );
remove_meta_box( 'dashboard_recent_drafts', 'dashboard', 'side' );
remove_meta_box( 'dashboard_primary', 'dashboard', 'side' );
remove_meta_box( 'dashboard_secondary', 'dashboard', 'side' );
}
add_action('wp_dashboard_setup', 'my_remove_dashboard_widgets' );
/**
* function my_blog_rss_output
* Build an RSS feed widget
*
* @since 1.0
*/
function my_blog_rss_output() {
echo '<div class="rss-widget">';
wp_widget_rss_output( array(
'url' => 'http://www.website.com/path/to/feed/',
'title' => 'Widget Title',
'items' => 2, // Number of items to display
'show_summary' => 1, // Boolean: show article excerpt
'show_author' => 1, // Boolean: show article author
'show_date' => 1, // Boolean: show article date
) );
echo "</div>";
}
/**
* function my_blog_rss_widget
* Display the RSS widget you built above
*
* @since 1.0
*/
function my_blog_rss_widget() {
add_meta_box( 'my-blog-rss', 'Widget Title', 'my_blog_rss_output', 'dashboard', 'side', 'high' );
}
add_action('wp_dashboard_setup', 'my_blog_rss_widget');