Skip to content

Commit

Permalink
Merge pull request #28 from GuyPrimavera/feature_refactor
Browse files Browse the repository at this point in the history
v3.1 updates
  • Loading branch information
GuyPrimavera authored May 31, 2021
2 parents 6ff50e0 + 975add4 commit b88e618
Show file tree
Hide file tree
Showing 75 changed files with 2,498 additions and 8,386 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Material Design inspired admin theme with a customisable color scheme. Add your

## Description

A Material Design inspired customisable color scheme and re-design for WordPress Admin (v4.0 onwards). Used by [Design by Mito](https://designbymito.com/) for client websites, Aquila also cleans up the admin area from unnecessary or potentially confusing items for the end-user.
A Material Design inspired customisable color scheme and re-design for WordPress Admin (v4.0 onwards). Useful for client websites, Aquila also cleans up the admin area from unnecessary or potentially confusing items for the end-user.

Many updates have been made to the admin area, including:

Expand Down
48 changes: 21 additions & 27 deletions admin/admin-bar.php
Original file line number Diff line number Diff line change
@@ -1,35 +1,29 @@
<?php
<?php if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) { exit; }

function aquila_admin_bar_links() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu('updates');
$wp_admin_bar->remove_menu('comments');
$wp_admin_bar->remove_menu('new-content');
$wp_admin_bar->remove_menu('vc_inline-admin-bar-link');
$wp_admin_bar->remove_menu('revslider');
$wp_admin_bar->remove_menu('customize');
$wp_admin_bar->remove_menu('themes');
$wp_admin_bar->remove_menu('widgets');
$wp_admin_bar->remove_menu('menus');

global $wp_admin_bar;
$wp_admin_bar -> remove_menu('updates');
$wp_admin_bar -> remove_menu('comments');
$wp_admin_bar -> remove_menu('new-content');
$wp_admin_bar -> remove_menu('vc_inline-admin-bar-link');
$wp_admin_bar -> remove_menu('revslider');
$wp_admin_bar -> remove_menu('customize');
$wp_admin_bar -> remove_menu('themes');
$wp_admin_bar -> remove_menu('widgets');
$wp_admin_bar -> remove_menu('menus');
}
add_action( 'wp_before_admin_bar_render', 'aquila_admin_bar_links', 999 );


// Remove "How are you" //
add_action('wp_before_admin_bar_render', 'aquila_admin_bar_links', 999);

// Remove "How are you"
function aquila_admin_bar_appearance() {
global $wp_admin_bar;
$user_id = get_current_user_id();
$user_id = get_current_user_id();
$current_user = wp_get_current_user();
$adminUser = $current_user->display_name;
$avatar = get_avatar( $user_id, 16 );
$wp_admin_bar->add_menu( array(
'id' => 'my-account',
'title' => ' ' . $adminUser . $avatar )
$adminUser = $current_user -> display_name;
$avatar = get_avatar($user_id, 16);
$wp_admin_bar -> add_menu(array(
'id' => 'my-account',
'title' => ' ' . $adminUser . $avatar )
);
}
add_action( 'wp_before_admin_bar_render', 'aquila_admin_bar_appearance' );



?>
add_action('wp_before_admin_bar_render', 'aquila_admin_bar_appearance');
4 changes: 1 addition & 3 deletions admin/adminBar.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php if ( __FILE__ == $_SERVER['SCRIPT_FILENAME'] ) { exit; }
<?php if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) { exit; }

include('adminBar/customLogo.php');
include('adminBar/adminBarStyle.php');
Expand All @@ -7,5 +7,3 @@
include('adminBar/adminBarTitle.php');
include('adminBar/screenLinks.php');
include('adminBar/removeHowdy.php');

?>
23 changes: 11 additions & 12 deletions admin/adminBar/adminBarIcon.php
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
<?php if ( __FILE__ == $_SERVER['SCRIPT_FILENAME'] ) { exit; }
<?php if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) { exit; }

// Add icon in place of admin bar
function aquila_adminbar_icon() {
if ( is_admin_bar_showing() ) {
if ( isset( $GLOBALS['aquilaShowFullAdminbar'] ) && $GLOBALS['aquilaShowFullAdminbar'] ) {
if (is_admin_bar_showing()) {
if (isset($GLOBALS['aquilaShowFullAdminbar']) && $GLOBALS['aquilaShowFullAdminbar']) {
echo '<style>
.aquilaFront #wpadminbar {
body.aquilaFront #wpadminbar {
display: block;
}
</style>';
}
} else {
echo '<div id="aquilaAdminbarIcon" title="Toggle Admin Bar"></div>';
}
}
}
add_action( 'admin_bar_menu', 'aquila_adminbar_icon', 999 );
add_action('admin_bar_menu', 'aquila_adminbar_icon', 999);

// Add body class
function aquila_adminbar_open_class( $classes ) {
if ( is_admin_bar_showing() ) {
if ( isset( $GLOBALS['aquilaShowFullAdminbar'] ) && isset( $GLOBALS['aquilaShowFullAdminbar'] ) ) {
$classes[] = 'aquilaOpenBar';
function aquila_adminbar_open_class($classes) {
if (is_admin_bar_showing()) {
if (isset($GLOBALS['aquilaShowFullAdminbar']) && $GLOBALS['aquilaShowFullAdminbar']) {
$classes[] = 'aquilaOpenBar aquilaShowBarDefault';
} else {
$classes[] = 'aquilaClosedBar';
}
Expand All @@ -29,5 +30,3 @@ function aquila_adminbar_open_class( $classes ) {
}
}
add_filter('body_class', 'aquila_adminbar_open_class');

?>
127 changes: 66 additions & 61 deletions admin/adminBar/adminBarLinks.php
Original file line number Diff line number Diff line change
@@ -1,77 +1,82 @@
<?php if ( __FILE__ == $_SERVER['SCRIPT_FILENAME'] ) { exit; }
<?php if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) { exit; }

// Admin Bar links
if ( ! isset( $GLOBALS['aquilaShowAdminbarLinks'] ) || !$GLOBALS['aquilaShowAdminbarLinks']) {
add_action( 'admin_bar_menu', 'aquila_admin_bar_cleanup', 200 );
function aquila_admin_bar_cleanup()
{
global $wp_admin_bar;
if ( !is_object( $wp_admin_bar ) ) {
return;
}
if (!isset($GLOBALS['aquilaShowAdminbarLinks']) || !$GLOBALS['aquilaShowAdminbarLinks']) {
function aquila_admin_bar_cleanup() {
global $wp_admin_bar;
if (!is_object($wp_admin_bar)) {
return;
}

$nodes = $wp_admin_bar->get_nodes();
$nodesKeep = array('wp-logo', 'site-name', 'adminTitle', 'screenOptions', 'contextHelp', 'menu-toggle', 'my-account', 'view', 'edit');
$nodes = $wp_admin_bar -> get_nodes();
$nodesKeep = array(
'wp-logo',
'site-name',
'adminTitle',
'screenOptions',
'contextHelp',
'menu-toggle',
'my-account',
'view',
'edit'
);

foreach( $nodes as $node )
{
if( (!$node->parent || 'top-secondary' == $node->parent) && (!in_array($node->id, $nodesKeep)) ) {
$wp_admin_bar->remove_menu( $node->id );
//echo $node->id . '<br/>';
}
}
foreach($nodes as $node) {
if((!$node->parent || 'top-secondary' == $node -> parent) && (!in_array($node -> id, $nodesKeep))) {
$wp_admin_bar->remove_menu($node->id);
}
}
}
add_action('admin_bar_menu', 'aquila_admin_bar_cleanup', 200);
}

// Remove nodes
add_action( 'admin_bar_menu', 'aquila_remove_wp_logo_nodes', 999 );
add_action('admin_bar_menu', 'aquila_remove_wp_logo_nodes', 999);
function aquila_remove_wp_logo_nodes() {
global $wp_admin_bar;
$wp_admin_bar->remove_node( 'about' );
$wp_admin_bar->remove_node( 'wporg' );
$wp_admin_bar->remove_node( 'documentation' );
$wp_admin_bar->remove_node( 'support-forums' );
$wp_admin_bar->remove_node( 'feedback' );
global $wp_admin_bar;
$wp_admin_bar -> remove_node('about');
$wp_admin_bar -> remove_node('wporg');
$wp_admin_bar -> remove_node('documentation');
$wp_admin_bar -> remove_node('support-forums');
$wp_admin_bar -> remove_node('feedback');
}

// Add Aquila links
if ( !isset($GLOBALS['aquilaHideLogoMenu']) || !$GLOBALS['aquilaHideLogoMenu']) {
if (!isset($GLOBALS['aquilaHideLogoMenu']) || !$GLOBALS['aquilaHideLogoMenu']) {
add_action('admin_bar_menu', 'aquila_wp_logo_links', 100);
}
function aquila_wp_logo_links($admin_bar){
$admin_bar->add_menu( array(
'id' => 'wpLessons',
'parent'=> 'wp-logo',
'title' => __( 'WordPress Lessons', 'aquila-admin-theme' ),
'href' => 'https://codex.wordpress.org/WordPress_Lessons',
'meta' => array(
'title' => __(''),
'class' => __(''),
'target' => __('_blank'),
),
));
$admin_bar->add_menu( array(
'id' => 'wpGuide',
'parent'=> 'wp-logo',
'title' => __( 'WordPress User Guide', 'aquila-admin-theme' ),
'href' => 'http://easywpguide.com/wordpress-manual/',
'meta' => array(
'title' => __(''),
'class' => __(''),
'target' => __('_blank'),
),
));
$admin_bar->add_menu( array(
'id' => 'mitoSupport',
'parent'=> 'wp-logo-external',
'title' => __( 'Aquila Support', 'aquila-admin-theme' ),
'href' => 'https://designbymito.com/support/',
'meta' => array(
'title' => __(''),
'class' => __(''),
'target' => __('_blank'),
),
));
$admin_bar->add_menu(array(
'id' => 'wpLessons',
'parent' => 'wp-logo',
'title' => __('WordPress Lessons', 'aquila-admin-theme'),
'href' => 'https://wordpress.org/support/article/wordpress-lessons/',
'meta' => array(
'title' => __(''),
'class' => __(''),
'target' => __('_blank'),
),
));
$admin_bar->add_menu(array(
'id' => 'wpGuide',
'parent' => 'wp-logo',
'title' => __('WordPress User Guide', 'aquila-admin-theme'),
'href' => 'http://easywpguide.com/wordpress-manual/',
'meta' => array(
'title' => __(''),
'class' => __(''),
'target' => __('_blank'),
),
));
$admin_bar->add_menu(array(
'id' => 'mitoSupport',
'parent' => 'wp-logo-external',
'title' => __('Aquila Support', 'aquila-admin-theme'),
'href' => 'https://wordpress.org/support/plugin/aquila-admin-theme/#new-post',
'meta' => array(
'title' => __(''),
'class' => __(''),
'target' => __('_blank'),
),
));
}

?>
23 changes: 13 additions & 10 deletions admin/adminBar/adminBarStyle.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
<?php if ( __FILE__ == $_SERVER['SCRIPT_FILENAME'] ) { exit; }
<?php if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) { exit; }

// Admin Bar height
function aquila_admin_bar() {
if ( is_admin_bar_showing() ) {
if (is_admin_bar_showing()) {
$topMargin = 0;
if (isset($GLOBALS['aquilaShowFullAdminbar']) && $GLOBALS['aquilaShowFullAdminbar']) {
$topMargin = 50;
}

echo "<style type='text/css' media='screen'>
html { margin-top: 0px !important; }
* html body { margin-top: 0px !important; }
html { margin-top: " . $topMargin . "px !important; }
* html body { margin-top: " . $topMargin . "px !important; }
@media screen and ( max-width: 782px ) {
html { margin-top: 0px !important; }
* html body { margin-top: 0px !important; }
html { margin-top: " . $topMargin . "px !important; }
* html body { margin-top: " . $topMargin . "px !important; }
}
</style>
";
}
}
add_action( 'wp_head', 'aquila_admin_bar', 99 );
remove_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );

?>
add_action('wp_head', 'aquila_admin_bar', 99);
remove_action('admin_color_scheme_picker', 'admin_color_scheme_picker');
17 changes: 7 additions & 10 deletions admin/adminBar/adminBarTitle.php
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
<?php if ( __FILE__ == $_SERVER['SCRIPT_FILENAME'] ) { exit; }
<?php if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) { exit; }

if ( is_admin() ) {
if (is_admin()) {
add_action('admin_bar_menu', 'aquila_adminbar_title', 100);
}

function aquila_adminbar_title($admin_bar){
$postType = false;
$postType = get_current_screen()->post_type;
$postTypeName = get_post_type_object( $postType );
$postType = get_current_screen() -> post_type;
$adminTitle = false;
$adminTitle = get_admin_page_title();
if ($adminTitle !== false && $postType !== false && is_admin()) {
$admin_bar->add_menu( array(
'id' => 'adminTitle',
$admin_bar -> add_menu(array(
'id' => 'adminTitle',
'title' => $adminTitle,
'href' => '',
'meta' => array(
'href' => '',
'meta' => array(
'title' => __($adminTitle),
),
));
}
}

?>
Loading

0 comments on commit b88e618

Please sign in to comment.