Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1480851

    hi
    I just moved my new site from a subdomain to my root. I was seeing an error:
    Warning: Undefined variable $preloader in /customers/a/3/6/c9w13mh8q/webroots/fa765f73/wp-
    Warning: Undefined variable $preloader in /customers/a/3/6/c9w13mh8q/webroots/fa765f73/wp-content/themes/enfold-child/header.php on line 266

    I had a header in my child theme that is using this code you gave me to limit the preloader to 2 pages only around line 40:

    if (is_page([1147, 945])) {
        $preloader = avia_get_option('preloader') === "preloader" 
            ? 'av-preloader-active av-preloader-enabled' 
            : 'av-preloader-disabled';

    }

    this was working ok on the subdomain but now it looks like all the pages that DON’T have the preloader are throwing that error which is also blocking the footer from loading on those pages. I took the header.php out of my child theme (I noticed it said not to add it to a child theme?) and have disabled the preloader, but it would be great to just have it on the front page if possible if I decide to use it.

    I also just added wp-rocket to my site since the videos were really loading slowly. It made it faster but sometimes the pages don’t load at all unless I stop and go back and forward again. Not sure if you can reproduce that. I am also seeing an error that on mobile the footer doesn’t load on the front page in any browser. There’s a video that loads at the top of the page but even when it’s fully loaded the whole footer section is gone. It’s fine on all the other pages. Not sure if that is due to a setting in wp rocket (I enabled mobile caching) or something else. I didn’t see that issue before I moved the site and added wp-rocket.

    thanks for your help
    Nancy

    • This topic was modified 1 week, 3 days ago by Munford.
    • This topic was modified 1 week, 3 days ago by Munford.
    • This topic was modified 1 week, 3 days ago by Munford.
    #1480860

    on header.php the original line is:

    $preloader = avia_get_option( 'preloader' ) == 'preloader' ? 'av-preloader-active av-preloader-enabled' : 'av-preloader-disabled';
    

    did you removed ( or commented out ) that line – and replaced it ?

    try :

    if (is_page(array(1147,945))) { 
    	$preloader = 'av-preloader-active av-preloader-enabled';
    } else {
    	$preloader = 'av-preloader-disabled';
    }

    PS – it is just a different way to write the array – you can use yours aswell.

    But: maybe it is better to have that option in enfold activated globaly – to have the oportunity to style it – and then remove that setting on all other pages then your array is set to if not logic.

    if (!is_page(array(1147,945) )){ 
    	$preloader = 'av-preloader-disabled';
    } else {
    	$preloader = 'av-preloader-active av-preloader-enabled';
    }
    #1480863

    Ok I’ll try that. And it’s OK to edit the header.php in the child theme?

    /*
    	* Please do not modify this file on your child theme to add scripts to Head section.
    	* Refer to this post - https://kriesi.at/documentation/enfold/add-custom-js-or-php-script/#add-a-script-to-head-section and use functions.php file instead
    	*/

    should I use this instead in the functions.php?

    //-------------------------------
    // Custom script in head section
    //-------------------------------
    
    function custom_script_name(){
    ?>
    <script>
    
    // Your script here
    
    </script>
    <?php
    }
    add_action('wp_head', 'custom_script_name');

    And the issue with the footer missing from the front page on mobil – is that something with wp rocket settings?

    Thanks
    Nancy

    • This reply was modified 1 week, 3 days ago by Munford.
    • This reply was modified 1 week, 3 days ago by Munford.
    • This reply was modified 1 week, 3 days ago by Munford.
    • This reply was modified 1 week, 3 days ago by Munford.
    #1480877

    well – as far as i can see – this solution given to you is based too on changing things in header.php:

    https://kriesi.at/support/topic/preloader-on-2-pages-loading-issues/#post-1480524

    my recommendation is only to use not the parent header.php but a copy of header.php inside your child-theme root directory.
    by this – an update will not overwrite the changings.

    However, since header.php is one of those files that is often affected by changes to the Enfold site, you need to keep track of whether you need to repeat this procedure with a new copy.

    If you have received a functions.php child theme solution from Enfold, it would be nice if you would post it.
    you can see here a working example page of my impressum page on a test installation:
    https://clean.webers-testseite.de/impressum/
    All other pages do not have a preloader.

    #1480885

    ok yes, I am using a copy in a child theme, but I guess that warning is because the header.php changes so often.

    Do you have an advice on the footer missing from my mobile front page? That’s kind of a bigger issue for us. Is it a caching issue with wp rocket?
    thanks for your help
    Nancy

    #1480892

    Hi,
    I see your footer on your mobile homepage and on your /third-ear-plus/ & /podcasts/ pages, see the screenshot below.

    Best regards,
    Mike

    #1480893

    You’re right – it’s loading now in Firefox but not in chrome or safari. I’ve cleared the data but it’s still not loading. It seems inconsistent in Firefox now – it only loads after I have cleared the data and accepted cookies, but if I return to the home page then it doesn’t load again. Not sure what’s going on and it’s not being blocked on the other pages that also have the cookie lock icon. Does it load for you on those other browsers or after returning to the home page?
    Thanks for all your help
    Nancy

    • This reply was modified 1 week, 2 days ago by Munford.
    • This reply was modified 1 week, 2 days ago by Munford.
    #1480896

    Hi,
    I tested chrome & safari without accepting cookies and logged out, and both showed the footer, so I’m not sure why you have this issue.

    Best regards,
    Mike

    #1480926

    I fixed this by changing some settings in wp rocket
    thanks for your help

    • This reply was modified 1 week, 2 days ago by Munford.
    #1480960

    Hi,
    Glad we were able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘preloader issues’ is closed to new replies.