Black Friday Sale! Get $20 off GP Premium, $40 off our new Lifetime license, and 45% off license renewals/extensions! Learn more

[Support request] Child Theme not working with Elementor

Home Forums Support Child Theme not working with Elementor

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #306590
    Marie Odile

    Hi Tom,
    This is kind of x-file mistery.

    Child Theme, I used this one : https://docs.generatepress.com/article/using-child-theme/

    /*
    Theme Name: GeneratePress Child
    Theme URI: http://generatepress.com
    Description: Default GeneratePress child theme
    Author: Thomas Usborne
    Author URI: http://edge22.com
    Template: generatepress
    Version: 0.1
    Tags: two-columns, three-columns, one-column, right-sidebar, left-sidebar, fluid-layout, responsive-layout, custom-header, custom-background, custom-menu, custom-colors, sticky-post, threaded-comments, translation-ready, featured-images, theme-options, light, white, dark, black, blue, brown, gray, green, orange, pink, purple, red, silver, tan, yellow
    */

    I have added some php in my functions.php

    <?php
    /**
     * Generate child theme functions and definitions
     *
     * @package Generate
     */
     
     //starting here customization
    add_filter( 'style_loader_src', 'generate_remove_cssjs_ver', 10, 2 );
    add_filter( 'script_loader_src', 'generate_remove_cssjs_ver', 10, 2 );
    function generate_remove_cssjs_ver( $src ) {
    	if( strpos( $src, '?ver=' ) )
    		$src = remove_query_arg( 'ver', $src );
    	
    	return $src;
    }
    
    add_action( 'init', 'generate_disable_wp_emojicons' );
    function generate_disable_wp_emojicons() 
    {
    	// all actions related to emojis
    	remove_action( 'admin_print_styles', 'print_emoji_styles' );
    	remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
    	remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
    	remove_action( 'wp_print_styles', 'print_emoji_styles' );
    	remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
    	remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
    	remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
    }
    /*add_filter( 'generate_fontawesome_essentials', 'generate_fontawesome_essentials' );
    function generate_fontawesome_essentials()
    {
        return true;
    }
    */
    //finishing here customization
    
    /*ajouter WPML widget*/
    /*
    add_action( 'generate_inside_navigation','tu_insert_into_navigation' );
    function  tu_insert_into_navigation()
    { ?>
        <div class="wpml-picker">
            <?php do_action( 'wpml_add_language_selector' ); ?>
        </div>
    <?php }
    */
    
    /* go to homepage without asking for confirmation when logging out*/
    function logout_redirect_home(){
    	wp_safe_redirect(home_url());
    	exit;
    }
    add_action('wp_logout', 'logout_redirect_home');
    
    //avoid having to confirm
    add_action('check_admin_referer', 'logout_without_confirm', 10, 2);
    function logout_without_confirm($action, $result)
    {
        /**
         * Allow logout without confirmation
         */
        if ($action == "log-out" && !isset($_GET['_wpnonce'])) {
            $redirect_to = isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '';
            $location = str_replace('&', '&', wp_logout_url($redirect_to));;
            header("Location: $location");
            die;
        }
    }

    The problem I see it’s that when I use either the Generatepress official theme or twenty seventeen any changes I do in Elementor are kept. However when my child theme is active then any style change is not saved. Adding content works but not changing styles. The issue is even worse, changes that were made with either the Generatepress official plugin or Twenty seventeen are not kept when moving back to the Child theme. It’s like a cache that keeps forever the version I created sometime ago with the child theme and can not get updated anymore only working with the child theme. I try to open even with incognito and doesn’t work neither. However, I just open a new browser with a complete different google login and then I see the changes.

    However I have deactivated all my plugins. All except Elementor and GeneratePRess pro. This is still happening. I have also deactivated cloudflare and SG Optimizer and W3 TOtal cache and I have deleted all my cookies several times.

    Any idea why ?
    Thank you in advance,
    Jesus

    GeneratePress 1.3.46
    #306618
    Marie Odile

    Hi Tom,
    Just to clarify and giving you more data on the tests I have done.

    IS definetely a cache problem but only happens when using the Child Theme.
    All changes that I made using child theme that are not visible with my browser when visiting https://www.thefrenchcandle.com, but that are visible with Elementor https://www.thefrenchcandle.com?elementor, becomes visible at the right moment I change my theme from GeneratePress Child theme to GeneratePRess (the parent one) or to Twenty Seventeen. And any changes that I make in Elementor on these themes are all the times visibile on both https://www.thefrenchcandle.com and https://www.thefrenchcandle.com?elementor but if I revert back to GeneratePress Child theme I still see the changes made on https://www.thefrenchcandle.com?elementor but not on http://www.thefrenchcandle.com
    However If I delete on any step all my cookies I see the changes on http://www.thefrenchcandle.com when using the ChildTheme but only the changes done until I delete the cookies. However any change made again while in the child theme I don’t see it again until I either delete cookies or change my theme on http://www.thefrenchcandle.com
    Any idea where in my code I could have messed up and cache is apllying in a particular manner only to my child theme ?

    Thank you,
    Jesus

    #306674
    Tom
    Lead Developer
    Lead Developer

    Hard to know for sure, but this function might be to blame:

    add_filter( 'style_loader_src', 'generate_remove_cssjs_ver', 10, 2 );
    add_filter( 'script_loader_src', 'generate_remove_cssjs_ver', 10, 2 );
    function generate_remove_cssjs_ver( $src ) {
    	if( strpos( $src, '?ver=' ) )
    		$src = remove_query_arg( 'ver', $src );
    	
    	return $src;
    }

    Can you try removing it?

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