Adding more links to the tool bar

So what you need to do is repeat what you’re doing, and we’ll use a foreach loop to achieve it I’ll give you an example of code that basically does what you need, but it creates an array of arrays. You initially created array called $args which represented a single link, but you need to … Read more

Admin menu link with variable

You can use wp_get_current_user() function to retrieve user login data. Also use get_edit_profile_url() to get profile page link. Note: You can use wp_logout_url() function for logout url. Try following code: add_action( ‘wp_before_admin_bar_render’, ‘wpdd_admin_bar_edit’ ); function wpdd_admin_bar_edit() { global $wp_admin_bar; // Show username with profile link $current_user = wp_get_current_user(); $username = $current_user->user_login; $profile_link = get_edit_profile_url(); $wp_admin_bar->add_menu( … Read more

Bootstrap navbar-fixed-top issues [closed]

In admin-bar.min.css at 600px, #wpadminbar is changed from position:fixed to position:absolute. The reason the adminbar scrolls at mobile sizes is because a fixed-height, fixed-position element causes major problems when you tap/pinch-to-zoom in mobile browsers. So, you can fix this by overriding WP’s native css on #wpadminbar, but then the behaviour is deliberate.

Site layout problems when logged in due to admin bar

This is really just a CSS question. The admin bar does its best to do this for all sites by giving a top margin to the <html> element: margin-top: 28px !important; But if the theme uses certain positioning methods, that rule won’t have the desired effect, which is what is happening in your case. From … Read more

Custom admin bar css on front end bug

You make it the wrong way. First, you do double work. Enqueue inside enqueue. You don’t need wp_enqueue_scripts(): wp_enqueue_style( ‘color-admin-bar’, PATH_TO_CSS, array( ‘admin-bar’ ) ); Second. Don’t use anonymous functions with WordPress Actions. Once-for-all-time is OK, but while the project is growing up you can collide with the inability to dequeue that style when you’ll … Read more