Allow editors to customise theme and widgets

There are two major opinions about  “allow or not other roles to access theme options”

By default only administrator has access to this area.

In production you may wish to allow editors (your client) to access that area for vary reasons. The most commons reasons area:

Menus are built using this area and the client must be able to change them: add, delete, change options menu and options order.

Theme options are in this area and the client must be able to change background colours or images etc.

How to do it:

Below you will find how how to give access to editor (role) to:

  • access theme options,  editors will see themes but will NOT be able to add / change / delete themes)
  • import and export all website content. Editors can backup / restore website content

Open your current theme “functions.php” and add to it:

/************* WOD - change editor capabilities  BOF *****************/
// get the the role object
$role_object = get_role( 'editor' );
// add $cap capability to this role object
$role_object->add_cap( 'edit_theme_options' );
$role_object->add_cap( 'export' );
$role_object->add_cap( 'import' );
/************* WOD - change editor capabilities EOF *****************/

You can install plugins but the best is to include into your theme this functionality because any plugin you will install will:

– increase the loading time

– increase the chance the website be hacked in

– make your website depended of the plugin provider, if you have many plugins then you will have soon problems with updating all and with “the developer just vanish”

Top

Leave a Reply

Your email address will not be published. Required fields are marked *