Home >Backend Development >PHP Tutorial >Briefly understand the tips to move the toolbar in WordPress to the bottom, wordpress tips_PHP tutorial
The concept of toolbar has been introduced since WordPress 3.1. When the user logs in, it will be displayed in the foreground A black toolbar will be displayed at the top of the page in the background. Through the toolbar, you can quickly create new articles, pages, media, users, and view articles and comments, as shown below:
Some WordPress users don’t like this toolbar and have chosen to remove it. By the way, this toolbar is still somewhat useful. Now you have another choice. If you don’t like it to be displayed at the top, then we can move this toolbar to the bottom of the page. Just add the following php code to the functions.php of the current theme. That’s it:
function fb_move_admin_bar() { echo ' <style type="text/css"> body { margin-top: -28px; padding-bottom: 28px; } body.admin-bar #wphead { padding-top: 0; } body.admin-bar #footer { padding-bottom: 28px; } #wpadminbar { top: auto !important; bottom: 0; } #wpadminba .quicklinks .menupop ul { bottom: 28px; } </style>'; } // 后台工具栏 add_action( 'admin_head', 'fb_move_admin_bar' ); // 前台工具栏 add_action( 'wp_head', 'fb_move_admin_bar' );
For Chrome users, there is a small problem when the toolbar is moved to the bottom. When the page has not been loaded, status information will be displayed at the bottom of Chrome, which will block the WordPress toolbar.