Skip to content

Instantly share code, notes, and snippets.

@woodwardtw
Created November 26, 2015 04:01
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save woodwardtw/49ccf90e56f81121d9c9 to your computer and use it in GitHub Desktop.
<?php
/**
* Plugin Name: PressThis Simple Button
* Plugin URI: https://notyet.com
* Description: This plugin adds a big button that says write and links to the simple Press This editor.
* Version: .007
* Author: Tom Woodward
* Author URI: http://bionicteaching.com
* License: GPL2
*/
//adds button to the dashboard but doesn't currently put it on top like I meant for it to (maybe later)
add_action( 'wp_dashboard_setup', 'register_my_dashboard_widget' );
function register_my_dashboard_widget() {
global $wp_meta_boxes;
wp_add_dashboard_widget(
'my_dashboard_widget',
'Get to work',
'my_dashboard_widget_display'
);
$dashboard = $wp_meta_boxes['dashboard']['normal']['core'];
$my_widget = array( 'my_dashboard_widget' => $dashboard['my_dashboard_widget'] );
unset( $dashboard['my_dashboard_widget'] );
$sorted_dashboard = array_merge( $my_widget, $dashboard );
$wp_meta_boxes['dashboard']['normal']['core'] = $sorted_dashboard;
}
add_action( 'wp_dashboard_setup', 'register_my_dashboard_widget' );
function my_dashboard_widget_display() {
echo '<a href="http://bionicteaching.com/wp-admin/press-this.php"><div class="pressbutton" style="display:block;
width:150px;
height:150px;
line-height:150px;
border: 2px solid #f5f5f5;
border-radius: 50%;
color:#f5f5f5;
text-align:center;
text-decoration:none;
background: #464646;
box-shadow: 0 0 3px gray;
font-size:30px;
font-weight:bold;">WRITE!</div></a>';
}
//collapses dashboard sidebar
function custom_admin_js() {
echo "<script type='text/javascript' >
document.body.className+=' folded';
</script>";
}
add_action('admin_footer', 'custom_admin_js');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment