| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Bottom Admin Toolbar |
| 4 |
* Plugin URI: https://wordpress.org/plugins/bottom-admin-toolbar/ |
| 5 |
* Description: Change your admin bar position by activating that simple extension. |
| 6 |
* Version: 1.4 |
| 7 |
* Tags: admin, bar, adminbar, bottom bar, toolbar, WordPress, bottom |
| 8 |
* Requires at least: 3.0 or higher |
| 9 |
* Requires PHP: 5.6 |
| 10 |
* Tested up to: 5.8 |
| 11 |
* Stable tag: 1.4 |
| 12 |
* Author: M . Code |
| 13 |
* License: GPL v2 or later |
| 14 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 15 |
* Contributors: M . Code |
| 16 |
* Donate link: https://ko-fi.com/devloper |
| 17 |
*/ |
| 18 |
|
| 19 |
// Variables |
| 20 |
define( 'BAB_PATH', plugin_dir_path( __FILE__ ) ); |
| 21 |
define( 'BAB_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets/' ); |
| 22 |
define( 'BAB_BASENAME', plugin_basename( __FILE__ ) ); |
| 23 |
|
| 24 |
if ( !class_exists( 'BottomAdminToolbar' ) ) : |
| 25 |
/** |
| 26 |
* BottomAdminToolbar |
| 27 |
*/ |
| 28 |
class BottomAdminToolbar { |
| 29 |
|
| 30 |
/** |
| 31 |
* Constructor |
| 32 |
*/ |
| 33 |
public function __construct() { |
| 34 |
$this->setup_actions(); |
| 35 |
} |
| 36 |
|
| 37 |
/** |
| 38 |
* Setting up Hooks |
| 39 |
*/ |
| 40 |
public function setup_actions() { |
| 41 |
add_theme_support( 'admin-bar', array( 'callback' => '__return_false' ) ); // Remove loaded default style |
| 42 |
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_files' ) ); // Enqueue Files |
| 43 |
} |
| 44 |
|
| 45 |
/** |
| 46 |
* Enqueue custom files |
| 47 |
*/ |
| 48 |
public function enqueue_files() { |
| 49 |
if ( is_admin_bar_showing() ) : |
| 50 |
wp_enqueue_style( 'bab-css', BAB_ASSETS_URL . 'bab.css', array(), '1.0', 'all' ); |
| 51 |
wp_enqueue_script( 'bab-js', BAB_ASSETS_URL . 'bab.js', array( 'jquery' ), '1.0', true ); |
| 52 |
endif; |
| 53 |
} |
| 54 |
|
| 55 |
} |
| 56 |
new BottomAdminToolbar(); |
| 57 |
endif; |
| 58 |
|