Skip to content

Instantly share code, notes, and snippets.

@norcross
Created November 4, 2011 23:36
Show Gist options
  • Save norcross/1340795 to your computer and use it in GitHub Desktop.
Save norcross/1340795 to your computer and use it in GitHub Desktop.
WCSD Admin
# custom login link
RewriteRule ^login$ http://localhost/whitelabel/wp-login.php [NC,L]
jQuery(document).ready(function($) {
$('form#loginform label[for="user_login"]').replaceWith('<label for="user_login">NEW LABEL<br /><input type="text" name="log" id="user_login" class="input" value="" size="20" tabindex="10" /></label>');
});
<?php
/*
Plugin Name: WordCamp San Diego 2012 Admin
Plugin URI: http://localhost/whitelabel
Description: Some swanky stuff to make your admin look GOOD
Author: Andrew Norcross
Version: 0.1
Requires at least: 3.3
Author URI: http://andrewnorcross.com
*/
/* Copyright 2012 Andrew Norcross
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License (GPL v2) only.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
//* custom CSS for admin logo and layout
function rkv_custom_stylez() {
echo '<link rel="shortcut icon" type="image/png" href="' . plugins_url( 'img/favicon.png', __FILE__) . '" />';
echo '<link rel="stylesheet" href="' . plugins_url( 'css/wcsd_admin_style.css', __FILE__) . '" type="text/css" media="screen" />';
}
add_action('login_head', 'rkv_custom_stylez');
add_action('admin_head', 'rkv_custom_stylez');
//* add admin logo link swap
function rkv_login_title($message) {
return get_bloginfo('description');
}
function rkv_login_url($message) {
return get_bloginfo('url');
}
add_filter('login_headerurl', 'rkv_login_url');
add_filter('login_headertitle', 'rkv_login_title');
// replace username label
function rkv_username_change() {
wp_enqueue_script( 'changename', plugins_url('/js/rkv_namechange.js', __FILE__) , array('jquery'), null, true );
}
add_action('login_enqueue_scripts', 'rkv_username_change');
//* re-order admin panel
function rkv_reorder_menu( $__return_true) {
return array(
'index.php', // this represents the dashboard link
'edit.php?post_type=page', // this is the default page menu
'edit.php', // this is the default POST admin menu
'upload.php',
);
}
add_filter('custom_menu_order', 'rkv_reorder_menu');
add_filter('menu_order', 'rkv_reorder_menu');
//* change main post labels
function rkv_main_post_menu_labels() {
global $menu;
global $submenu;
$menu[5][0] = 'News';
$submenu['edit.php'][5][0] = 'News';
$submenu['edit.php'][10][0] = 'Add News Item';
$submenu['edit.php'][15][0] = 'News Topics';
$submenu['edit.php'][16][0] = 'News Tags';
echo '';
}
add_action( 'admin_menu', 'rkv_main_post_menu_labels' );
//* Change post to product labels
function rkv_detail_post_labels() {
global $wp_post_types;
$labels = &$wp_post_types['post']->labels;
$labels->name = 'News';
$labels->singular_name = 'News';
$labels->add_new = 'Add News';
$labels->add_new_item = 'Add News';
$labels->edit_item = 'Edit News';
$labels->new_item = 'New';
$labels->view_item = 'View News';
$labels->search_items = 'Search News';
$labels->not_found = 'No News found';
$labels->not_found_in_trash = 'No News found in Trash';
}
add_action( 'init', 'rkv_detail_post_labels' );
//* change category labels
function rkv_change_category_labels() {
global $wp_taxonomies;
$labels = &$wp_taxonomies['category']->labels;
$labels->name = 'News Topics';
$labels->singular_name = 'News Topic';
$labels->add_new_item = 'Add New News Topic';
$labels->edit_item = 'Edit News Topic';
$labels->search_items = 'Search News Topics';
$labels->update_item = 'Update News Topic';
$labels->all_items = 'All News Topics';
}
add_action( 'init', 'rkv_change_category_labels' );
//* change tag labels
function rkv_change_tag_labels() {
global $wp_taxonomies;
$labels = &$wp_taxonomies['post_tag']->labels;
$labels->name = 'News Tags';
$labels->singular_name = 'News Tag';
$labels->add_new_item = 'Add New News Tag';
$labels->edit_item = 'Edit News Tag';
$labels->search_items = 'Search News Tags';
$labels->update_item = 'Update News Tag';
$labels->all_items = 'All News Tags';
}
add_action( 'init', 'rkv_change_tag_labels' );
//* remove dashboard widgets
function rkv_dashboard_cleanup() {
//* remove meta boxes
// remove_meta_box( 'dashboard_right_now', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_plugins', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_secondary', 'dashboard', 'side' );
remove_meta_box( 'dashboard_primary', 'dashboard', 'side' );
remove_meta_box( 'dashboard_recent_drafts', 'dashboard', 'side' );
remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' );
//* add call to include two custom ones
wp_add_dashboard_widget('rkv_help_text', 'Help and Support Links', 'rkv_help_links'); // add a new custom widget for help and support
wp_add_dashboard_widget('rkv_help_vids', 'Help and Support Videos', 'rkv_help_videos'); // add a new custom widget for help and support
}
add_action('wp_dashboard_setup', 'rkv_dashboard_cleanup');
//* add custom help links and video
function rkv_help_links() { ?>
<p>Take a look at these links</p>
<ul>
<li><a href="http://awesome.com">Support Link #1</a></li>
<li><a href="http://awesome.com">Support Link #2</a></li>
<li><a href="http://awesome.com">Support Link #1</a></li>
</ul>
<?php }
function rkv_help_videos() { ?>
<div style="width:420px; margin:0 auto; display:block;"><iframe width="420" height="243" src="http://www.youtube.com/embed/Wu7xiJ_HD6c" frameborder="0" allowfullscreen></iframe></div>
<?php }
//* change post title box text
function rkv_change_post_text( $title ) {
$screen = get_current_screen();
if ( 'post' == $screen->post_type ) {
$title = 'Enter Article Title';
}
return $title;
}
add_filter('enter_title_here', 'rkv_change_post_text');
//* remove items from the admin panel
function rkv_remove_extras_main() {
remove_menu_page('link-manager.php');
}
function rkv_remove_extras_sub() {
remove_submenu_page( 'themes.php', 'theme-editor.php' );
}
add_action( 'admin_menu', 'rkv_remove_extras_main' );
add_action( 'admin_init', 'rkv_remove_extras_sub' );
//* remove the columns I don't need
function rkv_edit_post_columns($defaults) {
unset($defaults['comments']);
unset($defaults['author']);
unset($defaults['date']);
return $defaults;
}
add_filter('manage_post_posts_columns', 'rkv_edit_post_columns'); // will affect all non-hierarchical post types
//* re-title my columns
function rkv_mod_columns($new_columns) {
$new_columns['title'] = _x('Article Name', 'column name');
$new_columns['categories'] = _x('News Topic', 'column name');
$new_columns['tags'] = _x('News Tags', 'column name');
return $new_columns;
}
add_filter('manage_posts_columns', 'rkv_mod_columns');
//* Make these columns sortable
# This code doesn't do anything. You've told WordPress they can be clicked to be sorted, but WordPress
# doesn't know how to sort them. See http://scribu.net/wordpress/custom-sortable-columns.html.
function rkv_sortable_columns($columns) {
$columns['categories'] = 'rkv_categories';
return $columns;
}
add_filter( 'manage_edit-post_sortable_columns', 'rkv_sortable_columns' );
//* determine sort from above
function rkv_column_orderby( $vars ) {
if ( isset( $vars['orderby'] ) && 'rkv_categories' == $vars['orderby'] ) {
$vars = array_merge( $vars, array(
'orderby' => 'name'
) );
}
return $vars;
}
add_filter( 'request', 'rkv_column_orderby' );
//* add new dashboard help page
add_action( 'admin_menu', 'rkv_dashboard_instruct_menu' );
function rkv_dashboard_instruct_menu() {
$page = add_dashboard_page( 'Instructions', 'Instructions', 'read', 'rkv_instructions', 'rkv_instruct_page');
}
function rkv_instruct_page() { ?>
<div class="wrap">
<div id="icon-rkv-instruct" class="icon32">
<br />
</div>
<h2>Instructions</h2>
<div id="rkv_instruction_page">
<p>Do this. Not that</p>
</div> <!-- end instruction wrap -->
</div> <!-- end page wrap -->
<?php }
//* set up tooltip
function rkv_tooltip_scripts() {
$enqueue = false;
$dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
if ( ! in_array( 'classy-pointer-setup', $dismissed ) ) {
$enqueue = true;
add_action( 'admin_print_footer_scripts', 'rkv_tooltip_footer' );
}
if ( $enqueue ) {
//* Enqueue pointers
wp_enqueue_script( 'wp-pointer' );
wp_enqueue_style( 'wp-pointer' );
}
}
add_action( 'admin_enqueue_scripts', 'rkv_tooltip_scripts' );
function rkv_tooltip_footer() {
$pointer_content = '<h3>' . __('LOUD NOISES!', 'wcsd-admin') . '</h3>';
$pointer_content .= '<p>' . __('Brick here killed a guy! With a trident!.','wcsd-admin') . '</p>';
?>
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready( function($) {
$('#menu-settings').pointer({
content: '<?php echo $pointer_content; ?>',
// edge: 'left',
position: {
my: 'left top',
at: 'right',
offset: '-90 5'
},
arrow: {
edge: 'bottom',
align: 'top',
offset: 10
},
// align: 'left',
close: function() {
$.post( ajaxurl, {
pointer: 'classy-pointer-setup',
action: 'dismiss-wp-pointer'
});
}
}).pointer('open');
});
//]]>
</script>
<?php }
@charset "utf-8";
/* CSS Document */
html, body {
height: 100%;
}
html {
background-color: #fff;
}
body.login {
background:#1D2736;
padding-top:0;
}
/* Set Gradient */
.widget .widget-top,
.postbox h3,
.stuffbox h3,
#widgets-right .sidebar-name,
#widgets-left .sidebar-name,
#widget-list .widget-top {
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#435366', endColorstr='#1D2736'); /* for IE */
background: -webkit-gradient(linear, center bottom, center top, from(#435366), to(#1D2736)); /* for webkit browsers */
background: -moz-linear-gradient(center bottom, #435366, #1D2736) repeat scroll 0 0 transparent;
}
/* Standardize Fonts */
#wphead h1,
.tablenav,
table.wp-list-table,
.widefat th,
#poststuff h3,
.metabox-holder h3,
#menu-management .nav-tab,
#thesis_options,
div.sidebar-name h3,
#dashboard_right_now td.b {
font-family: Arial,"Bitstream Vera Sans",Helvetica,Verdana,sans-serif;
}
div#icon-rkv-instruct {
background: url(../img/icon_how_to.png) no-repeat 0 0;
}
/* Login Screen */
#login {
margin:0 auto;
padding-top:30px;
}
#login h1 {
margin-top:60px;
padding:20px 0 0;
}
#login h1 a {
background:url(../img/login_logo.png) no-repeat top center !important;
height:154px;
width:300px;
margin:0 auto;
}
#login form {
box-shadow: 0 4px 18px #1D2736;
-moz-box-shadow: 0 4px 18px #1D2736;
}
.login #nav a, .login #backtoblog a {
color: #fff !important;
text-shadow:none;
}
/* Dashboard */
#wphead #header-logo {
background:url(../img/favicon.png) no-repeat scroll center center transparent;
height:16px;
width:16px;
}
#wphead {
border-bottom: 1px solid #435366;
}
#wphead h1 a {
color:#435366;
}
#user_info {
color: #435366;
}
#user_info a:link, #user_info a:visited {
color: #435366;
}
ul#adminmenu li.wp-has-current-submenu .wp-menu-arrow,
ul#adminmenu li.wp-has-current-submenu a.menu-top,
.folded ul#adminmenu li.wp-has-current-submenu .wp-menu-arrow,
.folded ul#adminmenu li.wp-has-current-submenu {
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#435366', endColorstr='#1D2736'); /* for IE */
background: -webkit-gradient(linear, center bottom, center top, from(#435366), to(#1D2736)); /* for webkit browsers */
background: -moz-linear-gradient(center bottom, #435366, #1D2736) repeat scroll 0 0 transparent;
}
#adminmenu li.wp-has-current-submenu a.menu-top {
border-bottom-color: #435366;
border-top-color: #1D2736;
}
.widget .widget-top, .postbox h3, .stuffbox h3 {
color:#fff;
text-shadow: 0 1px 0 #000000;
font-family: Arial,"Bitstream Vera Sans",Helvetica,Verdana,sans-serif;
}
.ui-sortable .postbox h3 {
color:#fff;
}
.widget .widget-top,
.sidebar-name:hover h3,
.postbox h3:hover,
.ui-sortable .postbox h3:hover {
color: #f9f2f7;
}
#adminmenu a {
color:#435366;
}
#adminmenu .wp-submenu a {
color:#000000;
}
.widget, .postbox, .stuffbox {
border-style: solid;
border-color:#435366;
}
#side-sortables #global_select input{
margin-right:5px;
}
#widgets-right .sidebar-name {
border-color:#435366;
color: #FFFFFF;
text-shadow: 0 -1px 0 #3F3F3F;
}
#widgets-left .sidebar-name {
border-color:#435366;
color: #FFFFFF;
text-shadow: 0 -1px 0 #3F3F3F;
}
#available-widgets .widget-holder,
div.widgets-sortables, #widgets-left .inactive {
background-color: #ffffff;
border-color: #435366;
}
#available-widgets .widget-description {
background-color: #ffffff;
color:#000000;
}
#normal-sortables #offerings_select table.form-table ul li{
display:inline;
margin-right:15px;
}
#normal-sortables #offerings_select table.form-table ul li label{
margin-left:5px;
}
#footer {
}
/* Full Screen setup */
#wp-fullscreen-body #fullscreen-topbar {
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#435366', endColorstr='#1D2736');
background: -webkit-gradient(linear, center bottom, center top, from(#435366), to(#1D2736));
background: -moz-linear-gradient(center bottom, #435366, #1D2736) repeat scroll 0 0 transparent;
}
#wp-fullscreen-body #fullscreen-topbar #wp-fullscreen-close a {
color:#fff;
}
/* Remove what we don't want */
/*
ul#adminmenu li#menu-links,
ul#adminmenu li#menu-comments {
display:none;
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment