|
|
@@ -8,6 +8,11 @@ via the functions file.
|
|
|
|
|
|
Developed by: Eddie Machado
|
|
|
URL: http://themble.com/bones/
|
|
|
+
|
|
|
+Special Thanks for code & inspiration to:
|
|
|
+@jackmcconnell - http://www.voltronik.co.uk/
|
|
|
+Digging into WP - http://digwp.com/2010/10/customize-wordpress-dashboard/
|
|
|
+
|
|
|
*/
|
|
|
|
|
|
/************* DASHBOARD WIDGETS *****************/
|
|
|
@@ -24,7 +29,7 @@ function disable_default_dashboard_widgets() {
|
|
|
remove_meta_box('dashboard_primary', 'dashboard', 'core'); //
|
|
|
remove_meta_box('dashboard_secondary', 'dashboard', 'core'); //
|
|
|
|
|
|
- /* plugin dashboard boxes */
|
|
|
+ // removing plugin dashboard boxes
|
|
|
remove_meta_box('yoast_db_widget', 'dashboard', 'normal'); // Yoast's SEO Plugin Widget
|
|
|
|
|
|
/*
|
|
|
@@ -35,5 +40,89 @@ function disable_default_dashboard_widgets() {
|
|
|
*/
|
|
|
}
|
|
|
|
|
|
+/*
|
|
|
+Now let's talk about adding your own custom Dashboard widget.
|
|
|
+Sometimes you want to show clients feeds relative to their
|
|
|
+site's content. For example, the NBA.com feed for a sports
|
|
|
+site. Here is an example Dashboard Widget that displays recent
|
|
|
+entries from an RSS Feed.
|
|
|
+
|
|
|
+For more information on creating Dashboard Widgets, view:
|
|
|
+http://digwp.com/2010/10/customize-wordpress-dashboard/
|
|
|
+*/
|
|
|
+
|
|
|
+// RSS Dashboard Widget
|
|
|
+function bones_rss_dashboard_widget() {
|
|
|
+ if(function_exists('fetch_feed')) {
|
|
|
+ include_once(ABSPATH . WPINC . '/feed.php'); // include the required file
|
|
|
+ $feed = fetch_feed('http://themble.com/feed/rss/'); // specify the source feed
|
|
|
+ $limit = $feed->get_item_quantity(7); // specify number of items
|
|
|
+ $items = $feed->get_items(0, $limit); // create an array of items
|
|
|
+ }
|
|
|
+ if ($limit == 0) echo '<div>The RSS Feed is either empty or unavailable.</div>'; // fallback message
|
|
|
+ else foreach ($items as $item) : ?>
|
|
|
+
|
|
|
+ <h4 style="margin-bottom: 0;">
|
|
|
+ <a href="<?php echo $item->get_permalink(); ?>" title="<?php echo $item->get_date('j F Y @ g:i a'); ?>" target="_blank">
|
|
|
+ <?php echo $item->get_title(); ?>
|
|
|
+ </a>
|
|
|
+ </h4>
|
|
|
+ <p style="margin-top: 0.5em;">
|
|
|
+ <?php echo substr($item->get_description(), 0, 200); ?>
|
|
|
+ </p>
|
|
|
+ <?php endforeach;
|
|
|
+}
|
|
|
+
|
|
|
+// calling all custom dashboard widgets
|
|
|
+function bones_custom_dashboard_widgets() {
|
|
|
+ wp_add_dashboard_widget('bones_rss_dashboard_widget', 'Recently on Themble (Customize on admin.php)', 'bones_rss_dashboard_widget');
|
|
|
+ /*
|
|
|
+ Be sure to drop any other created Dashboard Widgets
|
|
|
+ in this function and they will all load.
|
|
|
+ */
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
// removing the dashboard widgets
|
|
|
add_action('admin_menu', 'disable_default_dashboard_widgets');
|
|
|
+// adding any custom widgets
|
|
|
+add_action('wp_dashboard_setup', 'bones_custom_dashboard_widgets');
|
|
|
+
|
|
|
+
|
|
|
+/************* CUSTOM LOGIN PAGE *****************/
|
|
|
+
|
|
|
+// calling your own login css so you can style it
|
|
|
+function bones_login_css() {
|
|
|
+ /* i couldn't get wp_enqueue_style to work :( */
|
|
|
+ echo '<link rel="stylesheet" href="' . get_stylesheet_directory_uri() . '/library/css/login.css">';
|
|
|
+}
|
|
|
+
|
|
|
+// changing the logo link from wordpress.org to your site
|
|
|
+function bones_login_url() { echo bloginfo('url'); }
|
|
|
+
|
|
|
+// changing the alt text on the logo to show your site name
|
|
|
+function bones_login_title() { echo get_option('blogname'); }
|
|
|
+
|
|
|
+// calling it only on the login page
|
|
|
+add_action('login_head', 'bones_login_css');
|
|
|
+add_filter('login_headerurl', 'bones_login_url');
|
|
|
+add_filter('login_headertitle', 'bones_login_title');
|
|
|
+
|
|
|
+
|
|
|
+/************* CUSTOMIZE ADMIN *******************/
|
|
|
+
|
|
|
+/*
|
|
|
+I don't really reccomend editing the admin too much
|
|
|
+as things may get funky if Wordpress updates. Here
|
|
|
+are a few funtions which you can choose to use if
|
|
|
+you like.
|
|
|
+*/
|
|
|
+
|
|
|
+// Custom Backend Footer
|
|
|
+function bones_custom_admin_footer() {
|
|
|
+ echo '<span id="footer-thankyou">Developed by <a href="http://yoursite.com" target="_blank">Your Site Name</a></span>. Built using <a href="http://themble.com/bones" target="_blank">Bones</a>.';
|
|
|
+}
|
|
|
+
|
|
|
+// adding it to the admin area
|
|
|
+add_filter('admin_footer_text', 'bones_custom_admin_footer');
|
|
|
+
|