0

hi im using my own customize stylesheet using twitter bootstrap in wp-admin.

i have created my own navigation bar like below.

add_action('admin_head', 'myNavbar');
function myNavbar(){
    echo "
      <ul>
       <li class="active"> <a href="../wp-admin/"> HOME </li>
       <li><a href="../plugin.php"> PLUGIN</li>
      </ul>
          ";

}

how can i manipulate my markup to make <li class="active"> Plugin </li> when im in wp-admin/plugin.php

im thinking, getting the current page and create some conditional statement in PHP

if(isset($_GET) == '.../plugin.php') { 
    // change Markup here
}

not sure if this is the correct approach

0

not sure if this is the correct approach

Regardless of what the correct approach to adding an active class to the li element might be, adding a new navigation to the administrative backend is, beyond the shadow of a doubt, a very wrong approach in the first place.

Rather than doing that, familiarize yourself with how to manipulate the regular admin menus. Most likely, you want to be looking at the following functions:

add_menu_page() & add_submenu_page()
or add_options_page()

Update, pertaining to comments

If restyling the entire backend is what you have in mind, deregister the following stylesheets: wp-admin, admin-bar, buttons, media-views, wp-auth-check & wp-pointer, like so:

function wpse114884_remove_admin_styles() {
    wp_deregister_style( 'wp-admin' );
    wp_deregister_style( 'admin-bar' );
    wp_deregister_style( 'buttons' );
    wp_deregister_style( 'media-views' );
    wp_deregister_style( 'wp-auth-check' );
    wp_deregister_style( 'wp-pointer' );
}
add_action ( 'admin_enqueue_scripts', 'wpse114884_remove_admin_styles' );

Have fun, it'll be quite some work.

As for

It appears that the sidebar menu is #adminmenu, how do you target this to CSS? to rearrange?

  1. Use Firebug or Chrome's element inspector.

  2. If you have to ask this question, I'd suggest letting go of the idea. But have fun playing around!

  • yes i do understand that, but the reason being, is i want to re-style the current wp-admin into my own. i want to add my own navigation bar and put only selective admin pages onto it. – user1645034 Sep 20 '13 at 3:39
  • You can both remove pages from the existing menus as well as completely restyle the backend without messing with it's markup... – Johannes Pille Sep 20 '13 at 3:48
  • ok, i understand. if thats the case, it appears that the sidebar menu is #adminmenu, how do you target this to CSS? to rearrange ? – user1645034 Sep 20 '13 at 5:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.