Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #355142

    Hi there,
    Since your updates for Enfold are coming through quite often we thought we’d take an hour out to set up a child theme! 7 hours later and we have a fatal error.

    1. We followed the video and the WordPress org info

    2. We used cPanel to set up a new enfold-child folder containing 2 new files: styles.css and functions.php

    3. We had made only one change to the functions.php file and having read that we should not paste all the functions.php code into the new file we pasted simply:

    <?php

    global $avia_config;

    add_filter(‘avf_blog_style’,’avia_change_archive_blog_layout’, 10, 2);
    function avia_change_archive_blog_layout($layout, $context){
    if($context == ‘archive’) $layout = ‘blog-grid’;
    return $layout;
    }

    4. Since we’d made no additions to the style.css file, this php code in the php file seemed to be responsible for the fatal error (blank page, no admin access).

    5. We restored the site form a backup from inside cPanel and this time added all the functions.php code to the new functions.php file – same problem, fatal error.

    With respect, the video on child themes spends about 7 of the 9 minutes telling us what most people already know and in the final minute and a half rushes through the most important steps. A little clearer, step by step instruction and pitfalls to avoid would be very useful on what is clearly almost an obligation for all users.

    #355608

    Hey rpl_admin!

    First off download the starter child theme here, http://kriesi.at/documentation/enfold/downloads/.

    Next open up the child themes functions.php file and add this to the bottom.

    add_filter('avf_blog_style','avia_change_archive_blog_layout', 10, 2);
    function avia_change_archive_blog_layout($layout, $context){
    	global $avia_config;
    	if($context == 'archive') { $layout = 'blog-grid'; }
    	return $layout;
    }

    If your still getting an error then send us a WordPress login in a private reply and we’ll take a look.

    Cheers!
    Elliott

    #355685

    Hi Elliot,

    Many thanks for your reply. So I downloaded the child theme from the link you provided. Then FTP-ed that folder. It appeared in the WP themes. Then I Activated the child theme (as stated in the video, right?). Again I get blank white page, no admin access. So I can’t send you login until I restore everything again!

    What’s going on here? This should be a few minutes work, right? But we’ve now been on it a day and a half!

    Robert

    #355698
    This reply has been marked as private.
    #356272

    Hey!

    I logged in and noticed you have the child theme activated but everything looks fine on my end. I don’t see any blank pages anywhere. Try clearing your browser cache and deactivate all plugins.

    Cheers!
    Elliott

    #356455

    Hi Elliot,

    Yes, we managed to resolve it over the weekend. Apparently, we had the same snippets in the child theme functions.php as in the main theme functions.php and that was causing the issue. Taking that code out of the main functions.php seems to have worked.

    Can I just ask, if we can’t remember if we’ve edited the header.php and footer.php files but we want to use the child theme again for these, what’s the best way of doing so (we’re not familiar with PHP!)? Without causing fatal errors again

    Many thanks

    #357015

    Hi!

    1. Hmm, well taking it out of the parent theme functions.php file would defeat the purpose of using a child theme. What is the code your using?

    2. You could just copy them over to your child theme folder and they will be used instead of the parent theme files.

    Best regards,
    Elliott

    • This reply was modified 10 years, 1 month ago by Elliott.
    #357351

    Hi Elliot,

    1. Not sure I’m with you. We took the code below out of the main functions.php because it was code we had previously added:
    <?php

    /*
    * Add your own functions here. You can also copy some of the theme functions into this file.
    * WordPress will use those functions instead of the original functions then.
    */

    add_filter(‘avf_blog_style’,’avia_change_archive_blog_layout’, 10, 2);
    function avia_change_archive_blog_layout($layout, $context){
    if($context == ‘archive’) $layout = ‘blog-grid’;
    return $layout;
    }

    And once removed from the main file and only in the child theme functions.php the site was up and running again.

    2. The issue above, according to our host provider, was that there was a duplication of code in the main functions.php file and the child theme functions.php file. If we simply copy and paste the heading.php and footer.php files into the child theme will we not be causing the same kind of fatal error?

    Many thanks,

    Robert

    #357958

    Hi!

    1. I see. Yes you will want that in the child theme functions.php file only. If you have it also in the parent theme functions.php file then it’s going to cause a “function with same name” error.

    2. You can do that with template files (header, footer, sidebar, etc etc). WordPress will use them instead of the parent theme templates. The functions.php file will be executed on both though, child and parent.

    Best regards,
    Elliott

    • This reply was modified 10 years, 1 month ago by Elliott.
Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.