| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPAdminify\Inc\Classes; |
| 4 |
|
| 5 |
class Adminify_Admin_Bar extends \WP_Admin_Bar { |
| 6 |
|
| 7 |
public function render() { |
| 8 |
$root = $this->_bind(); |
| 9 |
|
| 10 |
if ( empty( $root ) ) { |
| 11 |
return; |
| 12 |
} |
| 13 |
|
| 14 |
$class = 'nojq nojs'; |
| 15 |
if ( wp_is_mobile() ) { |
| 16 |
$class .= ' mobile'; |
| 17 |
} |
| 18 |
|
| 19 |
?> |
| 20 |
<div id="wpadminbar" class="<?php echo esc_attr( $class ); ?>"> |
| 21 |
<?php if ( ! is_admin() && ! did_action( 'wp_body_open' ) ) { ?> |
| 22 |
<a class="screen-reader-shortcut" href="#wp-toolbar" tabindex="1"><?php esc_html_e( 'Skip to toolbar', 'adminify' ); ?></a> |
| 23 |
<?php } ?> |
| 24 |
<div class="quicklinks navbar" id="wp-toolbar" role="navigation" aria-label="<?php esc_attr_e( 'Toolbar', 'adminify' ); ?>"> |
| 25 |
<?php |
| 26 |
foreach ( $root->children as $group ) { |
| 27 |
if ( $group->id !== 'top-secondary' ) { |
| 28 |
$this->_render_group( $group ); |
| 29 |
} |
| 30 |
} |
| 31 |
|
| 32 |
if ( is_admin() ) { |
| 33 |
do_action( 'adminify/before/secondary_menu' ); |
| 34 |
} |
| 35 |
|
| 36 |
foreach ( $root->children as $group ) { |
| 37 |
if ( $group->id === 'top-secondary' ) { |
| 38 |
$this->_render_group( $group ); |
| 39 |
} |
| 40 |
} |
| 41 |
?> |
| 42 |
</div> |
| 43 |
<?php if ( is_user_logged_in() ) : ?> |
| 44 |
<a class="screen-reader-shortcut" href="<?php echo esc_url( wp_logout_url() ); ?>"><?php esc_html_e( 'Log Out', 'adminify' ); ?></a> |
| 45 |
<?php endif; ?> |
| 46 |
</div> |
| 47 |
|
| 48 |
<?php |
| 49 |
} |
| 50 |
|
| 51 |
} |
| 52 |
|