• Is it possible to set a specific fallback theme, instead of having to use one of the WP ones?

    I’ve tested 2024 thru 2020 and each of them makes my site unusable.
    Astra, however, looks 98% like my regular theme, Hello Elementor, when loaded.

    Ideally, I’d like it to automatically change over if there was a problem with Hello Elementor as I live on the opposite side of the world to my target audience so if something did happen, I’d probably be asleep while they’d be trying to access my site!

Viewing 9 replies - 1 through 9 (of 9 total)
  • I believe the answer to this is surprisingly simple. All you need to do is delete all themes from Appearance-> Themes that you do not want to use. That will leave your primary theme which you will activate and Astra as your back up should the primary break.

    Thread Starter jasperdemann

    (@jasperdemann)

    That *does* sound surprisingly simple, thanks!

    I’ll give it a try tomorrow.

    How would I test that it would work when it’s needed?

    Hi Jasperdemann,

    There is no built-in feature to set a custom fallback theme. However, you can achieve this functionality using custom code.

    Here’s a basic example of a custom PHP script that activates the Astra theme if the Hello Elementor theme fails to load:

    function custom_fallback_theme() {
    if (!function_exists('hello_elementor_init')) {
    switch_theme('astra');
    }
    }
    add_action('init', 'custom_fallback_theme');

    This script checks if the <code class=””>hello_elementor_init function exists, which indicates that the Hello Elementor theme is active and functioning properly. If the function is not found, it switches the active theme to Astra.

    This can help ensure your website remains accessible and functional regardless of potential problems.

    You can use the Code Snippet Plugin to add the script to your site.

    Hope this helps!

    I’m not sure there’s a way to test it. I believe it’s setup to use whatever theme is available should the active theme fail or have an issue.

    I’ll add another twist to the answers already given:

    • You will need to ensure that any other theme you don’t need by default is disabled, so that you only have the active theme and the fallback one. This is for safety’s sake.
    • You will need at least one default theme in the radar. By experience, they’re simply designed and can provide the knack to troubleshoot when you need something barebones.

    Great answers here, though!

    Thread Starter jasperdemann

    (@jasperdemann)

    Thanks for your help, everyone.

    I’ll keep Hello Elementor active, Astra installed and I’ve added the code.

    Cheers!

    Thread Starter jasperdemann

    (@jasperdemann)

    Hi, @anieeedet

    I added the code, but it deactivates Hello and activates Astra permanently.
    If I try to activate Hello, the page refreshes but Astra is still the active theme.

    Thread Starter jasperdemann

    (@jasperdemann)

    Anyone got any advice?!

    Thread Starter jasperdemann

    (@jasperdemann)

    Anyone?!!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Set a Fallback Theme’ is closed to new replies.