Add shortcut to admin bar

This commit is contained in:
Brian Miyaji
2016-01-08 19:15:02 +11:00
parent 7b1d9346a6
commit 13f78b9815
2 changed files with 75 additions and 0 deletions

View File

@@ -380,6 +380,16 @@
display: none;
}
/* Admin Bar */
#wpadminbar #wp-admin-bar-sportspress>.ab-item:before {
font-family: sportspress, dashicons;
}
#wpadminbar #wp-admin-bar-sportspress>.ab-item:before {
content: "\f111";
top: 2px;
}
/* Media Queries */
@media screen and (min-width: 801px) {
/* Widget Alignment */

View File

@@ -0,0 +1,65 @@
<?php
/*
Plugin Name: SportsPress Admin Bar
Plugin URI: http://themeboy.com/
Description: Add widgets to SportsPress.
Author: ThemeBoy
Author URI: http://themeboy.com/
Version: 1.9.14
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! class_exists( 'SportsPress_Admin_Bar' ) ) :
/**
* Main SportsPress Admin Bar Class
*
* @class SportsPress_Admin_Bar
* @version 1.9.14
*/
class SportsPress_Admin_Bar {
/**
* Constructor
*/
public function __construct() {
// Define constants
$this->define_constants();
add_action( 'admin_bar_menu', array( $this, 'add_node' ), 40 );
}
/**
* Define constants.
*/
private function define_constants() {
if ( !defined( 'SP_ADMIN_BAR_VERSION' ) )
define( 'SP_ADMIN_BAR_VERSION', '1.9.14' );
if ( !defined( 'SP_ADMIN_BAR_URL' ) )
define( 'SP_ADMIN_BAR_URL', plugin_dir_url( __FILE__ ) );
if ( !defined( 'SP_ADMIN_BAR_DIR' ) )
define( 'SP_ADMIN_BAR_DIR', plugin_dir_path( __FILE__ ) );
}
/**
* Add node to admin bar menu.
*/
public function add_node( $wp_admin_bar ) {
if ( is_admin() ) return;
$args = array(
'id' => 'sportspress',
'title' => __( 'SportsPress', 'sportspress' ),
'href' => add_query_arg( 'page', 'sportspress', admin_url( 'admin.php' ) ),
);
$wp_admin_bar->add_node( $args );
}
}
endif;
new SportsPress_Admin_Bar();