[Resolved] Custom Child Theme Issues Upgrading to GP3.0

Home Forums Support [Resolved] Custom Child Theme Issues Upgrading to GP3.0

Home Forums Support Custom Child Theme Issues Upgrading to GP3.0

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1505654
    Dean

    Hi Tom

    Having issues updating a site with a custom child theme to GP3.0. Currently testing it on Staging so no damage yet.

    For example after updating to GP3.0 – the primary menu set as “current” in the customizer goes from white to black on the frontend, h1 title size goes from 36px to 40px in customizer and other settings not being carried across too.

    After playing around I think I may have found the main issue. I created a GP child theme setting all the customizer settings via PHP like you do with your GP child themes e.g.

    /**
     * Colour defaults. Set some extra default colour options here!
     */
    if ( !function_exists( 'my_custom_set_color_defaults' ) ) :
    	//add_filter( 'generate_color_option_defaults','my_custom_set_color_defaults' );
    	function my_custom_set_color_defaults( $my_custom_color_defaults )
    	{
    			/** Customising-->Colours-->Primary Navigation **/
    			$my_custom_color_defaults[ 'navigation_background_color' ] = '#ffffff';
    			$my_custom_color_defaults[ 'navigation_text_color' ] = '#000000';
    			$my_custom_color_defaults[ 'navigation_background_hover_color' ] = '#ffffff';
    			$my_custom_color_defaults[ 'navigation_text_hover_color' ] = '#8f919e';
    			$my_custom_color_defaults[ 'navigation_background_current_color' ] = '#ffffff';
    			$my_custom_color_defaults[ 'navigation_text_current_color' ] = '#8f919e';
    
    			/** Customising-->Colours-->Primary Sub-Navigation **/
    			$my_custom_color_defaults[ 'subnavigation_background_color' ] = '#f6f9fc';
    			$my_custom_color_defaults[ 'subnavigation_text_color' ] = '#000000';
    			$my_custom_color_defaults[ 'subnavigation_background_hover_color' ] = '#f6f9fc';
    			$my_custom_color_defaults[ 'subnavigation_text_hover_color' ] = '#8f919e';
    			$my_custom_color_defaults[ 'subnavigation_background_current_color' ] = '#f6f9fc';
    			$my_custom_color_defaults[ 'subnavigation_text_current_color' ] = '#8f919e';
    
    			/** Customising-->Colours-->Buttons **/
    			$my_custom_color_defaults[ 'form_button_background_color' ] = '#0070ba';
    			$my_custom_color_defaults[ 'form_button_text_color' ] = '#ffffff';
    			$my_custom_color_defaults[ 'form_button_background_color_hover' ] = '#005ea6';
    			$my_custom_color_defaults[ 'form_button_text_color_hover' ] = '#ffffff';
    
    			/** Customising-->Colours-->Content **/
    			$my_custom_color_defaults[ 'content_background_color' ] = '#ffffff';
    			$my_custom_color_defaults[ 'content_text_color' ] = '';
    			$my_custom_color_defaults[ 'content_link_color' ] = '';
    			$my_custom_color_defaults[ 'content_link_hover_color' ] = '';
    			$my_custom_color_defaults[ 'content_title_color' ] = '';
    			$my_custom_color_defaults[ 'blog_post_title_color' ] = '';
    			$my_custom_color_defaults[ 'blog_post_title_hover_color' ] = '';
    			$my_custom_color_defaults[ 'entry_meta_text_color' ] = '#595959';
    			$my_custom_color_defaults[ 'entry_meta_link_color' ] = '#595959';
    			$my_custom_color_defaults[ 'entry_meta_link_color_hover' ] = '#1e73be';
    			$my_custom_color_defaults[ 'h1_color' ] = '';
    			$my_custom_color_defaults[ 'h2_color' ] = '';
    			$my_custom_color_defaults[ 'h3_color' ] = '';
    			$my_custom_color_defaults[ 'h4_color' ] = '';
    			$my_custom_color_defaults[ 'h5_color' ] = '';
    
    			/** Customising-->Colours-->Sidebar Widgets **/
    			$my_custom_color_defaults[ 'sidebar_widget_background_color' ] = '#ffffff';
    			$my_custom_color_defaults[ 'sidebar_widget_text_color' ] = '';
    			$my_custom_color_defaults[ 'sidebar_widget_link_color' ] = '';
    			$my_custom_color_defaults[ 'sidebar_widget_link_hover_color' ] = '';
    			$my_custom_color_defaults[ 'sidebar_widget_title_color' ] = '#000000';
    
    			/** Customising-->Colours-->Footer Widgets **/
    			$my_custom_color_defaults[ 'footer_widget_background_color' ] = '#4e2782';
    			$my_custom_color_defaults[ 'footer_widget_text_color' ] = '#ffffff';
    			$my_custom_color_defaults[ 'footer_widget_link_color' ] = '#ffffff';
    			$my_custom_color_defaults[ 'footer_widget_link_hover_color' ] = '#0070ba';
    			$my_custom_color_defaults[ 'footer_widget_title_color' ] = '#ffffff';
    
    			/** Customising-->Colours-->Footer **/
    			$my_custom_color_defaults[ 'footer_background_color' ] = '#161413';
    			$my_custom_color_defaults[ 'footer_text_color' ] = '#afafaf';
    			$my_custom_color_defaults[ 'footer_link_color' ] = '#afafaf';
    			$my_custom_color_defaults[ 'footer_link_hover_color' ] = '#ffffff';
    			$my_custom_color_defaults[ 'back_to_top_background_color' ] = 'rgba(0,0,0,0.4)';
    			$my_custom_color_defaults[ 'back_to_top_text_color' ] = '#ffffff';
    			$my_custom_color_defaults[ 'back_to_top_background_color_hover' ] = 'rgba( 0,0,0,0.6 )';
    			$my_custom_color_defaults[ 'back_to_top_text_color_hover' ] = '#ffffff';
    
    			/** Customising-->Colours-->Woocommerce **/
    			$my_custom_color_defaults[ 'wc_alt_button_background' ] = '#0070ba';
    			$my_custom_color_defaults[ 'wc_alt_button_background_hover' ] = '#005ea6';
    			$my_custom_color_defaults[ 'wc_alt_button_text' ] = '#ffffff';
    			$my_custom_color_defaults[ 'wc_alt_button_text_hover' ] = '#ffffff';
    
    			$my_custom_color_defaults[ 'wc_product_title_color' ] = '';
    			$my_custom_color_defaults[ 'wc_product_title_color_hover' ] = '';
    			$my_custom_color_defaults[ 'wc_rating_stars' ] = '#ffa200';
    			$my_custom_color_defaults[ 'wc_sale_sticker_background' ] = '#c90404';
    			$my_custom_color_defaults[ 'wc_sale_sticker_text' ] = '#ffffff';
    			$my_custom_color_defaults[ 'wc_price_color' ] = '#222222';
    
    			$my_custom_color_defaults[ 'wc_panel_cart_background_color' ] = '#ffffff';
    			$my_custom_color_defaults[ 'wc_panel_cart_text_color' ] = '#000000';
    			$my_custom_color_defaults[ 'wc_panel_cart_button_background' ] = '';
    			$my_custom_color_defaults[ 'wc_panel_cart_button_background_hover' ] = '';
    			$my_custom_color_defaults[ 'wc_panel_cart_button_text' ] = '';
    			$my_custom_color_defaults[ 'wc_panel_cart_button_text_hover' ] = '';
    
    			$my_custom_color_defaults[ 'wc_mini_cart_background_color' ] = '#ffffff';
    			$my_custom_color_defaults[ 'wc_mini_cart_text_color' ] = '#000000';
    			$my_custom_color_defaults[ 'wc_mini_cart_button_background' ] = '';
    			$my_custom_color_defaults[ 'wc_mini_cart_button_background_hover' ] = '';
    			$my_custom_color_defaults[ 'wc_mini_cart_button_text' ] = '';
    			$my_custom_color_defaults[ 'wc_mini_cart_button_text_hover' ] = '';
    
    			$my_custom_color_defaults[ 'wc_price_slider_background_color' ] = '#dddddd';
    			$my_custom_color_defaults[ 'wc_price_slider_bar_color' ] = '#666666';
    
    			$my_custom_color_defaults[ 'wc_product_tab' ] = '#222222';
    			$my_custom_color_defaults[ 'wc_product_tab_highlight' ] = '#1e73be';
    			$my_custom_color_defaults[ 'wc_success_message_background' ] = '#0b9444';
    			$my_custom_color_defaults[ 'wc_success_message_text' ] = '#ffffff';
    			$my_custom_color_defaults[ 'wc_info_message_background' ] = '#1e73be';
    			$my_custom_color_defaults[ 'wc_info_message_text' ] = '#ffffff';
    			$my_custom_color_defaults[ 'wc_error_message_background' ] = '#c90404';
    			$my_custom_color_defaults[ 'wc_error_message_text' ] = '#ffffff';
    
    			return $my_custom_color_defaults;
    	}
    endif;

    FYI after updating I am not touching the floats / flexbox or any other settings for that matter before issues occur.

    I tried:

    1) Exporting GP Settings, removing the customiser php from my child theme functions.php file, updating to GP3.0 and then re-importing GP Settings after the update which didn’t solve the problem.

    2) I also tried going through each page in the customiser, changing 1 setting, changing it back and clicking publish before doing step 1 above. That also didn’t seem to work.

    Moving forward, how can ensure all the GP customiser settings set in PHP in my child theme are saved in the customiser correctly and get rid of the customizer settings php in my child theme as I think this will obviously cause more and more issues in future.

    Thanks Dean.

    #1506670
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    That function will set the defaults in the theme – defaults only apply if there are no saved settings.

    In order to migrate people from GP 2 to 3, we had to save the old defaults so their websites didn’t change appearance after updating.

    Instead of setting the defaults, try overwriting the actual options:

    add_filter( 'option_generate_settings', function( $settings ) {
        $settings[ 'navigation_background_color' ] = '#ffffff';
        // and so on..
    
        return $settings;
    } );

    Hope this helps! ๐Ÿ™‚

    #1509065
    Dean

    Hi Tom.

    Thanks for your reply. I tried it and for some reason that didn’t seem to work for me.

    Thought I would just update the ticket with a solution that worked for me in case anyone else comes across this.

    I ended up updating the staging site first to the latest version of GP3. I then removed all customizer PHP code from my functions.php. After that I manually copied across the settings in the customiser from my Live (working site) to my staging site until everything was identical again on the staging site frontend.

    After doing this I exported the GP settings from the working staging site and imported to the Live site. Removed the customizer php code from the live site functions.php and then proceeded to update the live site to GP3.0 and all worked as expected :-).

    Note: you may have a link in the GP settings json export file (e.g. mobile menu logo). So make sure to open the file and check for any site links and update with your live domain before importing to your live site.

    #1509895
    Tom
    Lead Developer
    Lead Developer

    Glad you got it working – thanks for sharing your process! ๐Ÿ™‚

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