Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I would like to remove everything except the “form” in wp-admin/post.php

I would like to do this for user role "author" only.

The reason for all this: I want the wp-admin/post.php to be a page where the author only can edit the content, clean from everything else (the will be linked to the page from the mainpage...)

Today I have slowed this using CSS. But that loads all unnecessary HTML, js and CSS files.

Now I wonder if there’s a way to do this using PHP?

Thanks in advance!

edit:

Se this link: http://i.stack.imgur.com/ziCg9.jpg (new users aren't allowed to post images...)

I want the admin panel to only show this when authors press the "edit-post-link".

if ($current_user->user_level < 8){code here...}
share|improve this question
    
Interesting question. Can you edit it to include a screenshot of what it looks like (or should look like)? That way it is even easier to understand at a glance. –  Jan Fabry Apr 9 '11 at 20:51
    
Thanks for your comment. I have added a link to a image. I want the window to show only this. It is easy to fix with css, but I want to remove all unnecessary HTML, java and css as well... –  Hakan Apr 10 '11 at 6:54
    
Keep in mind too, that security could be an issue. Just because you hide something with CSS, doesn't mean someone couldn't edit it to show the menu, header, etc. –  Chris Aug 8 '11 at 18:47
add comment

1 Answer

I Think there is no hooks that I can find to remove those areas without touching the core files..

You can remove parts of the admin areas using this functions and with some css help.

To hide Menus

// remove unnecessary menus  
function remove_admin_menus () {  
    global $menu;  
    // all users  
    $restrict = explode(',', 'Links,Comments');  
    // non-administrator users  
    $restrict_user = explode(',', 'Media,Profile,Appearance,Plugins,Users,Tools,Settings,Dashboard,Posts,Pages');  
    // WP localization  
    $f = create_function('$v,$i', 'return __($v);');  
    array_walk($restrict, $f);  
    if (!current_user_can('activate_plugins')) {  
        array_walk($restrict_user, $f);  
        $restrict = array_merge($restrict, $restrict_user);  
    }  
    // remove menus  
    end($menu);  
    while (prev($menu)) {  
        $k = key($menu);  
        $v = explode(' ', $menu[$k][0]);  
        if(in_array(is_null($v[0]) ? '' : $v[0] , $restrict)) unset($menu[$k]);  
    }  
}  
add_action('admin_menu', 'remove_admin_menus');  


?>

To Brand your Header

/**REPLACE WP LOGO**/
function custom_admin_css() {
echo '<link rel="stylesheet" id="custom_admin" type="text/css" href="' . get_bloginfo('template_directory') . '/custom/custom_admin.css" />';
}

add_action('admin_head','custom_admin_css');
/**END REPLACE WP LOGO**/

And create a custom_admin.css file with this line

#header-logo {background-image: url(images/client_logo.jpg);}

To modify Header Menu

//Edit Top Menu
function custom_favorite_actions($actions) {
  unset($actions['edit-comments.php']); //remove Comments from menu
  unset($actions['media-new.php']); // remove Upload media menu
  unset($actions['post-new.php?post_type=page']); // Remove options/menu for new pages

  return $actions;
}

add_filter('favorite_actions', 'custom_favorite_actions');

To Replace the footer

/**REPLACE FOOTER TEXT**/
function filter_footer_admin() { ?>
Created by <a href="#">Your Company</a> | Built with <a href="http://wordpress.org">WordPress</a>
<?php }

add_filter('admin_footer_text', 'filter_footer_admin');
/**END REPLACE FOOTER TEXT**/
share|improve this answer
    
Thanks for your answer Mauri. I find the same conclusion as you, and it's never a good idea to edit the core files. I think it is best to remove what you can and fix the rest with css. Or maybe use a preg_replace function :) –  Hakan Apr 10 '11 at 6:51
    
I was looking for something similar the other day and at the wordpress codec i found out that other option is that you can also make a wordpress admin theme, but you need to install a 3rd party plugin in order to work.. –  mauri Apr 10 '11 at 8:00
    
Thanks for comment mauri. Will wordpress admin themes allow me to remove eg. the footer? Please provide me with this information! –  Hakan Apr 10 '11 at 11:57
    
Hello, here is the article codex.wordpress.org/Creating_Admin_Themes Im sorry, but you have to create the theme as a plugin. –  mauri Apr 11 '11 at 22:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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