Hello Igor.
I managed to fix this issue, and here’s how I did it, just for the benefit of you and others that might want to do the same.
The problem is that the theme overrides the wordpress config settings with a section in the theme functions.php file. Since it is not advisable to change functions.php directly, the following solution worked for me.
- 1. Create a child theme including a blank functions.php file
- 2. Create a blank maintenance.php file (containing the content you want to be displayed in maintenance mode)
- 3. Upload all the assets required for displaying the maintenance page (e.g. images, css, etc) into your child theme directory
- 4. Upload the maintenance.php file into the wp-content directory, ensuring that the links reference the correct assets folder in your theme directory, to pull in all the required images and css
- 5. Copy the code below into the functions.php file in your child theme, and save it. (Or add it to your functions.php file if you already have an existing child theme with custom functions)
- 6. Enable maintenance mode in the theme options, and delete cache to see the changes. (Note you will not see it if logged in as admin, so either log out first before previewing, or open your site in another browser where you are not logged in as admin)
<?php
/* CUSTOM MAINTENANCE MODE
=================================================== */
function custom_maintenance_mode() {
$options = get_option('sf_neighborhood_options');
if (isset($options['enable_maintenance'])) {
$maintenance_mode = $options['enable_maintenance'];
} else {
$maintenance_mode = false;
}
if ($maintenance_mode) {
if ( !current_user_can( 'edit_themes' ) || !is_user_logged_in() ) {
if ( file_exists( WP_CONTENT_DIR . '/maintenance.php' ) ) {
require_once( WP_CONTENT_DIR . '/maintenance.php' );
die();
}
}
}
}
add_action('get_header', 'custom_maintenance_mode');
?>
I hope you find this helpful.
Just reply if you have any issues, and will help if I can! 🙂