add a class when login

If you are using the body_class() function, a class admin-bar will be added automatically when the admin bar is active. For example: <body class=”home blog logged-in admin-bar”> You can then use that class in your CSS to specify specific rules: .admin-bar .Div1 { /* custom styles */ }

why my menu is not appearing on the admin panel

You are using add_options_page() so this means that you are adding a page menu item under settings section of your WP admin menu. By the sounds of it you dont want to add your page there but you really want it to appear as a sub page of the pages menu. Am I correct in … Read more

Why am I unable to login after converting to www?

You don’t need a rewrite rule in .htaccess to add www back in. Remove the rewrite rule, remove all the defines in wp-config and try to login. If that doesn’t work, delete permalinks in .htaccess to force them back to default. After you’re in, add the www in Dashboard>>Settings and save. Then reset permalinks.

Execute script only on certain admin pages

You can use this in your functions.php : function add_admin_scripts( $hook ) { if ( $hook == ‘post-new.php’ ) { wp_enqueue_script( ‘myscript’, get_bloginfo(‘template_directory’).’/js/myscript.js’ ); } } add_action(‘admin_enqueue_scripts’,’add_admin_scripts’,10,1);

Create a admin page in wordpress without admin menus (“wordpress sidebars”)

You can use the built in ThickBox to display the popup by Ajax: //first add thickbox to your page function add_thickbox(){ if(is_admin() && (isset($_GET[‘page’]) && $_GET[‘page’] == “my-plugin-file.php”) { wp_enqueue_script(‘jquery’); wp_enqueue_script(‘thickbox’,null,array(‘jquery’)); wp_enqueue_style(‘thickbox.css’, “https://wordpress.stackexchange.com/”.WPINC.’/js/thickbox/thickbox.css’, null, ‘1.0’); } } add_action(‘wp_enqueue_script’,’add_thickbox’); //then in your user list for each user you add the thickbox //popup on the onclick and … Read more

Hide extra menus from WordPress Dashboard

Update As the Answer wasn’t best practice, I replace it with a link to my simple plugin that even does more than the OP needed. You can take it as reference on how to (re)move different things in the admin UI. It’s freely available Open Source Software. I encourage you to fork it. Functionality The … Read more