Skip to content

Commit

Permalink
Merge pull request #6 from GuyPrimavera/v2.0
Browse files Browse the repository at this point in the history
v2.0
  • Loading branch information
GuyPrimavera authored Feb 13, 2018
2 parents 45c412c + 524cd7e commit 6605fbe
Show file tree
Hide file tree
Showing 43 changed files with 9,449 additions and 2,359 deletions.
5 changes: 4 additions & 1 deletion admin/adminBar.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php
<?php
if ( __FILE__ == $_SERVER['SCRIPT_FILENAME'] ) { exit; }

include('adminBar/adminBarLinks.php');
include('adminBar/adminBarTitle.php');
include('adminBar/screenLinks.php');
include('adminBar/removeHowdy.php');

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

// Admin Bar links

Expand All @@ -24,11 +25,70 @@ function aquila_admin_bar_links() {
$wp_admin_bar->remove_menu('w3tc');
$wp_admin_bar->remove_menu('all-in-one-seo-pack');
$wp_admin_bar->remove_menu('updraft_admin_node');
$wp_admin_bar->remove_menu('customer-area');
$wp_admin_bar->remove_menu('itsec_admin_bar_menu');

$wp_admin_bar->remove_menu('maintenance_options');
$wp_admin_bar->remove_menu('tribe-events');
}
add_action( 'wp_before_admin_bar_render', 'aquila_admin_bar_links', 999 );

}

// Remove nodes

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' );
}

// Add Aquila links

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',
'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',
'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',
'href' => __('https://designbymito.com/support/'),
'meta' => array(
'title' => __(''),
'class' => __(''),
'target' => __('_blank'),
),
));

}

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

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 );
$adminTitle = false;
$adminTitle = get_admin_page_title();

if ($adminTitle !== false && $postType !== false && is_admin()) {

$admin_bar->add_menu( array(
'id' => 'adminTitle',
'title' => $adminTitle,
'href' => '',
'meta' => array(
'title' => __($adminTitle),
),
));

/*
if ($postType !== false) {
$admin_bar->add_menu( array(
'id' => 'viewAll',
'parent' => 'adminTitle', // Rename when ready for "Add new"
'title' => 'All ' . $postTypeName->labels->name,
'href' => get_admin_url( ) . 'edit.php?post_type=' . $postType,
'meta' => array(
'title' => __('My Sub Menu Item'),
'target' => '_blank',
'class' => 'my_menu_item_class'
),
));
$admin_bar->add_menu( array(
'id' => 'my-second-sub-item',
'parent' => 'adminTitle',
'title' => 'New ' . $postTypeName->labels->singular_name,
'href' => get_admin_url( ) . 'post-new.php?post_type=' . $postType,
'meta' => array(
'title' => __('My Second Sub Menu Item'),
'target' => '_blank',
'class' => 'my_menu_item_class'
),
));
}
*/
}
}

?>
3 changes: 2 additions & 1 deletion admin/adminBar/removeHowdy.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
<?php
if ( __FILE__ == $_SERVER['SCRIPT_FILENAME'] ) { exit; }

// Remove "How are you" //

Expand Down
31 changes: 31 additions & 0 deletions admin/adminBar/screenLinks.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
if ( __FILE__ == $_SERVER['SCRIPT_FILENAME'] ) { exit; }

add_action('admin_bar_menu', 'new_screenlinks', 100);
function new_screenlinks($admin_bar){

$admin_bar->add_menu( array(
'id' => 'screenOptions',
'title' => '',
'href' => '',
'meta' => array(
'title' => __(''),
'class' => __('screenLink'),
),
));

$admin_bar->add_menu( array(
'id' => 'contextHelp',
'title' => '',
'href' => '',
'meta' => array(
'title' => __(''),
'class' => __('screenLink'),
),
));



}

?>
6 changes: 3 additions & 3 deletions admin/dashboard.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php
<?php
if ( __FILE__ == $_SERVER['SCRIPT_FILENAME'] ) { exit; }

include('widgets/removeWidgets.php');
include('widgets/welcomeWidget.php');
include('widgets/supportWidget.php');
include('widgets/pluginWidget.php');

include('functions/addClasses.php');
include('functions/adminBarStyle.php');
include('functions/hideNag.php');
include('functions/postToBlog.php');
include('functions/aquilaDash.php');
include('functions/customLogo.php');
include('functions/footer.php');

?>
39 changes: 29 additions & 10 deletions admin/functions/addClasses.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,40 @@
<?php
<?php
if ( __FILE__ == $_SERVER['SCRIPT_FILENAME'] ) { exit; }

// Add role to body

function aquila_admin_body_role($classes) {
global $current_user;
$user_role = array_shift($current_user->roles);
$classes .= 'role-'. $user_role;
return $classes;

//global $current_user;
//$userRole = array_shift($current_user->roles);

$classes .= 'aquila aquilaAdmin';
return $classes;

}
//add_filter('body_class','aquila_admin_body_role');
add_filter('admin_body_class', 'aquila_admin_body_role');

function aquila_admin_body_class($classes) {
$classes[] = 'aquila';
return $classes;

function aquila_front_body_class( $classes ) {


if ( is_admin_bar_showing() ) {

//global $current_user;
//$userRole = array_shift($current_user->roles);

$classes[] = 'aquila aquilaFront';
return $classes;

} else {

$classes[] = ' ';
return $classes;

}

}
add_filter('body_class', 'aquila_admin_body_class');
//add_filter('admin_body_class', 'aquila_admin_body_class');
add_filter('body_class', 'aquila_front_body_class');

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

// Admin Bar height

Expand All @@ -7,8 +8,8 @@ function aquila_admin_bar() {
if ( is_admin_bar_showing() ) {

echo "<style type='text/css' media='screen'>
html { margin-top: 50px !important; }
* html body { margin-top: 50px !important; }
html { margin-top: 65px !important; }
* html body { margin-top: 65px !important; }
@media screen and ( max-width: 782px ) {
html { margin-top: 46px !important; }
* html body { margin-top: 46px !important; }
Expand All @@ -20,4 +21,7 @@ function aquila_admin_bar() {

add_action( 'wp_head', 'aquila_admin_bar', 99 );

remove_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );


?>
106 changes: 106 additions & 0 deletions admin/functions/customLogo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?php
if ( __FILE__ == $_SERVER['SCRIPT_FILENAME'] ) { exit; }

// Custom Logo

$aquilaOptions = get_option( 'aquila_settings' );

if( isset($aquilaOptions['aquila_new_logo']) && $aquilaOptions['aquila_new_logo'] !== "" ) {

// Admin bar
function aquila_new_logo_admin() {

$options = get_option( 'aquila_settings' );
if ( isset ( $options['aquila_new_logo'] ) ) {
$aquilaNewLogo = $options['aquila_new_logo'];
} else {
$aquilaNewLogo = 'none';
};

echo "<style type='text/css'>
#wpadminbar li#wp-admin-bar-wp-logo > .ab-item .ab-icon:before {
display: none!important;
}
#wpadminbar #wp-toolbar li#wp-admin-bar-wp-logo > .ab-item span.ab-icon {
background-image: url('" . $aquilaNewLogo . "')!important;
background-size: contain;
background-repeat: no-repeat;
background-position: center center;
margin: 5%!important;
max-width: 90%;
height: 60%;
}
</style>";
}

add_action( 'admin_bar_init', 'aquila_new_logo_admin', 82 );

// Login screen
function aquila_new_logo_login() {

$options = get_option( 'aquila_settings' );
if ( isset ( $options['aquila_new_logo'] ) ) {
$aquilaNewLogo = $options['aquila_new_logo'];
} else {
$aquilaNewLogo = 'none';
};

echo "<style type='text/css'>
body.login #login:before {
display: none!important;
}
body.login #login h1 a {
display: block!important;
}
body.login #login h1 a {
background-image: url('" . $aquilaNewLogo . "')!important;
background-size: contain;
background-repeat: no-repeat;
background-position: center center;
width: auto;
height: 80px;
max-width: 350px;
}
</style>";
}

add_action( 'login_head', 'aquila_new_logo_login', 82 );

}

// Custom Logo (square)

if( isset($aquilaOptions['aquila_new_logo_sqr']) && $aquilaOptions['aquila_new_logo_sqr'] !== "" ) {

function aquila_new_logo_sqr_admin() {

$options = get_option( 'aquila_settings' );
if ( isset ( $options['aquila_new_logo_sqr'] ) ) {
$aquilaNewLogoSqr = $options['aquila_new_logo_sqr'];
} else {
$aquilaNewLogoSqr = 'none';
};

echo "<style type='text/css'>
body.folded #wpadminbar li#wp-admin-bar-wp-logo > .ab-item .ab-icon:before {
display: none!important;
}
body.folded #wpadminbar #wp-toolbar li#wp-admin-bar-wp-logo > .ab-item span.ab-icon {
background-image: url('" . $aquilaNewLogoSqr . "')!important;
background-size: contain;
background-repeat: no-repeat;
background-position: center center;
margin: 20% 10%!important;
max-width: 80%;
height: 60%;
}
</style>";
}

add_action( 'admin_bar_init', 'aquila_new_logo_sqr_admin', 83 );

}



?>
Loading

0 comments on commit 6605fbe

Please sign in to comment.