Support » Plugins and Hacks » Hacks » [Resolved] Align menu on Admin Bar

[Resolved] Align menu on Admin Bar

  • Hello,
    I use this following code to add a login link for logout user

    function add_login_link( $meta = FALSE ) {
    	global $wp_admin_bar, $blog_id;
    	if ( is_user_logged_in() ) { return false; }
    	$wp_admin_bar->add_menu( array(
    		'id' => 'login_menu',
    		'title' => __( 'Log in or Sign up' ),
    		'href' => get_home_url( $blog_id, '/wp-login.php' ) )
    add_filter( 'show_admin_bar', '__return_true' ); /* turn on adminbar for logged out users */
    add_action( 'admin_bar_menu', 'add_login_link', 15 );

    However, thi Log in or Sign up link was put on the left. How to move it to the end right?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Not 100% sure, but from the looks of things, you add 'parent' => 'top-secondary', to the add_menu() arguments array. top-secondary is a menu group which has float: right; CSS assigned to it.

    Thank you very much,
    Your code works like a charm to align right my menu.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Align menu on Admin Bar’ is closed to new replies.
Skip to toolbar