Lynda Tutorial Link in Rampages Dashboard Plugin

Screen Shot 2016-08-26 at 12.09.40 PM

Nothing fancy here but maybe useful to someone. Based on a faculty member request, I took the WP widget API default code and created a little dashboard widget to put a link to the WordPress tutorials on every dashboard page (network activated).

Can’t hurt and I think I’ll end up expanding this into a messaging system so I can publish “breaking” news and other useful tips.

Plugin Name: ALT Lab add to Dashboard
Plugin URI:
Description: This allows you to add stuff to the dashboards of sites
Version:     1.0
Author:      Tom Woodward
Author URI:
License:     GPL2
License URI:
Domain Path: /languages
Text Domain: my-toolset

defined( 'ABSPATH' ) or die( 'No script kiddies please!' );

function altlab_add_dashboard_widgets() {
 		'ALT Lab Tips', 
 		'altlab_dashboard_widget_function' );
 	// Globalize the metaboxes array, this holds all the widgets for wp-admin
 	global $wp_meta_boxes;
 	// Get the regular dashboard widgets array 
 	// (which has our new widget already but at the end)
 	$normal_dashboard = $wp_meta_boxes['dashboard']['normal']['core'];
 	// Backup and delete our new dashboard widget from the end of the array
 	$altlab_widget_backup = array( 'altlab_dashboard_widget' => $normal_dashboard['altlab_dashboard_widget'] );
 	unset( $normal_dashboard['altlab_dashboard_widget'] );
 	// Merge the two arrays together so our widget is at the beginning
 	$sorted_dashboard = array_merge( $altlab_widget_backup, $normal_dashboard );
 	// Save the sorted array back into the original metaboxes 
 	$wp_meta_boxes['dashboard']['normal']['core'] = $sorted_dashboard;

add_action( 'wp_dashboard_setup', 'altlab_add_dashboard_widgets' );

 * Create the function to output the contents of our Dashboard Widget.
function altlab_dashboard_widget_function() {

	// Display whatever it is you want to show.
	echo '
	<img src="">
	<a class="wp-core-ui button button-primary button-hero" style="margin: 15px;" href="">
	  Video Tutorials for WordPress <span class="dashicons dashicons-controls-play" style="font-size:2em; padding-top:8px;"></span>

Comments on this post

No comments.

Leave a Reply

Trackbacks and Pingbacks on this post

No trackbacks.

TrackBack URL