Most advice I see on redesigning a live site with Oxygen is to create a completely separate staging site, as you would typically.

However Oxygen is quite unique. With Oxygen installed, the plugin overides not only the previous theme, but the content as well.  This means you can recreate your entire site with your new design and content on the same pages with Oxygen.

The way to do this is to enable Oxygen only for yourself (or your team) for development (you will see Oxygen frontend and backend when logged in) and all other users (frontend and backend, logged in and logged out) will see the current version and Oxygen will be completely invisible to them.  This is done by uploading a php file (shown below). Then when you are ready to go live, simply remove that php file so that everyone sees the new version.

Please note that the standard way of redesigning a site with a staging site may be more appropriate in certain situations, such as if you are changing the functionality of your site. You will need to consider which is the best approach based on what changes you will be making.

Here is how to do it:

  1. Create a folder in your wp-content folder called mu-plugins
  2. Then in your mu-plugins folder create a php file called enable-by-user.php with this code below
    Substitute the usernames (in line 6, 7 and 8)  with the usernames of those who will have access to Oxygen:
<?php
function enable_by_user_plugin( $plugins ) {
require (ABSPATH . WPINC . '/pluggable.php');
$user = wp_get_current_user();
$acceptable_users = array( // List of username ( login names ) to enable the plugin for.
'test',
'admin',
'user8162',
);
if(
empty( $user ) ||
( ! empty( $user ) && ! in_array( $user->user_login, $acceptable_users ) )
) {
$key = array_search( 'oxygen/functions.php' , $plugins );
if ( false !== $key ) {
unset( $plugins[ $key ] );
}
}
return $plugins;
}
add_filter( 'option_active_plugins', 'enable_by_user_plugin' );

?>

Thats it!  Please leave a comment below on your thoughts on this and if it worked for you.

 

Share