Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Add function to stop admin menu being responsive WordPress

I would like to know if there is a php function that I can add to my custom theme function that will disable the WordPress admin sidebar menu from being responsive.

Answers (4)

2013-05-03

Dava Gordon answers:

it isnt really a function you need you just need to update the css

Open wp-admin.min.css

find
@media only screen and (max-width:900px){.auto-fold #wpcontent,.auto-fold #wpfooter{margin-left:52px}.auto-fold #adminmenuback,.auto-fold #adminmenuwrap,.auto-fold #adminmenu,.auto-fold #adminmenu li.menu-top{width:32px}.auto-fold #adminmenu .wp-submenu.sub-open,.auto-fold #adminmenu .opensub .wp-submenu,.auto-fold #adminmenu .wp-has-current-submenu .wp-submenu.sub-open,.auto-fold #adminmenu .wp-has-current-submenu.opensub .wp-submenu,.auto-fold #adminmenu a.menu-top:focus+.wp-submenu,.auto-fold #adminmenu .wp-has-current-submenu a.menu-top:focus+.wp-submenu{top:-1px;left:32px}.auto-fold #adminmenu a.wp-has-current-submenu:focus+.wp-submenu,.auto-fold #adminmenu .wp-has-current-submenu .wp-submenu{border-width:1px;border-style:solid;position:absolute;top:-1000em}.auto-fold #adminmenu li.menu-top .wp-submenu>li>a{padding-left:12px}.auto-fold #adminmenu .wp-menu-name{display:none}.auto-fold #adminmenu .wp-submenu-head{display:block}.auto-fold #adminmenu div.wp-menu-image{width:32px;position:absolute;z-index:25}.auto-fold #adminmenu a.menu-top{height:28px}.auto-fold #adminmenu li .wp-menu-arrow{-moz-transform:translate(32px);-webkit-transform:translate(32px);-o-transform:translate(32px);-ms-transform:translate(32px);transform:translate(32px)}.auto-fold #adminmenu li .wp-menu-arrow div{display:none}.auto-fold #adminmenu li.current .wp-menu-arrow,.auto-fold #adminmenu li.current .wp-menu-arrow div,.auto-fold #adminmenu li.wp-has-current-submenu .wp-menu-arrow div,.auto-fold #adminmenu li.wp-menu-open .wp-menu-arrow,.auto-fold #adminmenu li a:focus .wp-menu-arrow{display:block}.auto-fold #adminmenu li.wp-menu-open{border:0 none}.auto-fold #adminmenu li.wp-has-current-submenu{margin-bottom:1px}.auto-fold #adminmenu .wp-has-current-submenu.menu-top-last{margin-bottom:0}.auto-fold #collapse-menu span{display:none}}

and Delete it job done


Ciaran Whelan comments:

Hi, doing this is removing it from the core... which means on update to WP, it will be over written. Ideally I need a function filter if it is available.

2013-05-04

DHRUBA BHOWMIK answers:

This is handled by the /navigation.js script ..

the line responsible for this is this

<script src="http://wp-themes.com/wp-content/themes/twentytwelve/js/navigation.js?ver=1.0" type="text/javascript">

you can disable that on line 103 at functions.php :

wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '1.0', true );

Just comment it like so :

// wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '1.0', true );


I do not really understand why would you want to disable this.


Ciaran Whelan comments:

Hi there,

I want to add a function to my custom-function.php

I have designed up an admin skin and removed all of the icons, so I want to have that admin menu non responsive

Unfortunately, commenting it out in the core is not what I want to do. I need a filter if it is possible?

2013-05-04

Giri answers:

functions.php

add_action( 'admin_print_styles', 'custom_admin_css' );
add_action( 'wp_enqueue_scripts', 'custom_admin_css' );

function custom_admin_css(){
if( is_admin() ) {
wp_enqueue_style(
"custom_admin_css",
get_bloginfo('template_directory')."/css/custom_admin.css",
false,
false,
"all"
);
}
}


Now create a new css file (custom_admin.css) in your theme css folder.

add your custom admin css codes there.

You should override old admin styles. For example like this.

@media only screen and (max-width: 900px) {
.auto-fold #adminmenu .wp-menu-name {
display: block;
}
.auto-fold #adminmenuback, .auto-fold #adminmenuwrap, .auto-fold #adminmenu, .auto-fold #adminmenu li.menu-top {
width: 145px;
}
}

2013-05-05

Julien Maury answers:

Hi, if you have designed your own skin maybe you can try this :
if ( is_admin())
add_action( 'style_loader_tag', create_function( '$a', "return null;" ) );


That will totally remove default CSS styles from admin. It's a little bit radical but it works.

EDIT: then you can add you own styles with a simple echo (do not enqueue because it won't load)