Home Forums Pro Themes Education Hub Pro Switch back to parent theme from child theme not retaining Parent theme settings

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #66404
    Pethick Pethick
    Participant

    Hi,
    We would like to create child theme for “Education Hub Pro”.

    Tried with default child theme setup by following below steps:
    1. Creating “education-hub-pro-child” directory in theme directory and placed style.css and functions.php files

    2. Activated child theme it not retain parent theme setting then switch back parent theme completely lost parent theme settings like log, design issues and additional link in header section.

    Here is sample child theme preview that confilict with parent refer screen cast: https://screencast-o-matic.com/watch/cFnr1Xo91T

    Education Hub Pro theme is not switching comparability form child theme to parent theme also not retaining parent theme settings properly

    Let us know way to fix this issue.

    Thanks

    #66425
    wensolutions
    Keymaster

    Hello @timechart,

    First of all thank you very much for using the pro version of the theme.

    Yes, the child theme will not import the customizer setting of the parent theme.

    However, you can import the parent theme setting to the child theme by adding the below-given custom code.

    For this add the code given below in your child theme functions.php file

    education_hub_pro_child_customizer_options_import() {
    
    if ( get_stylesheet() !== get_template() ) {
      add_filter( 'pre_update_option_theme_mods_' . get_stylesheet(), function ( $value, $old_value ) {
           update_option( 'theme_mods_' . get_template(), $value );
           return $old_value; // prevent update to child theme mods
      }, 10, 2 );
      add_filter( 'pre_option_theme_mods_' . get_stylesheet(), function ( $default ) {
          return get_option( 'theme_mods_' . get_template(), $default );
      } );
    }
    }
    
    add_action('init', 'education_hub_pro_child_customizer_options_import');

    Also not to forget it is always the best idea to go through the child theme for any modification in the parent theme as the original theme file will be safe and protected.

    Hope this helps.

    Best Regards!!

    Have a good day 🙂 .

    #66557
    Pethick Pethick
    Participant

    Thank you very much. This solution has worked well.

    #66568
    wensolutions
    Keymaster

    Hello @timechart,

    Glad to know your issue has been resolved.

    If you have any queries/issues further, please feel free to post your queries here.

    Best Regards !!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.