WordPress.org

Ready to get started?Download WordPress

Forums

Various White Screens with Child Theme + functions.php (14 posts)

  1. niericentral
    Member
    Posted 3 years ago #

    I asked here, but haven't seen any replies.

    If I make a child theme of twenty ten everything works great with plugins, css, replacement templates etc. However, as soon as I add any kind of functions.php to the child theme folder, I get all kind of white screen problems that vary depending on the functions.php.

    Two cases:
    1) Copy the twenty ten functions.php exactly as it is into the child theme folder: everything goes white. Can't load any wp-admin pages. Site itself is a white page.

    2) Use a very simple functions.php as follows:

    <?php
    if (!is_admin())
      add_filter('widget_title', 'do_shortcode', 11);
    ?>

    Things seem to work, but actually any page/post updates and other types of events will result in a white screen. Using the back button shows that updates were made, but getting a whitescreen all the time is annoying and worrisome. Worse is that the login screen does not work any more. As long as I stay logged in, I can work. But the log in page changes to a white screen with this little piece of garbage characters: "" (not sure if that will be reproduced accurately).

    Any helpful advice?

  2. Shadowz
    Member
    Posted 3 years ago #

    Yeah i had the very same problem, did an exact copy in to child theme folder for twenty ten, and its would not let me see wp-admin.

    So i just deleted everything and just put what i needed in <?php ?>

    But mine seems to be working fine now.

    However for you i was thinking about this,

    Maybe if you just put the whole functions.php file in the child theme folder with all the changes and deleted the default functions.php from the default twenty ten folder it might work like normal.

    just everytime you update wordpress you would need to delete the default functions.php

  3. niericentral
    Member
    Posted 3 years ago #

    Thanks for the idea. I tried it, but I seem to get the same results as I did before. Just to confirm (php noob here), I added my code immediately after the opening <?php of the original as follows:

    <?php
    if (!is_admin())
    	add_filter('widget_title', 'do_shortcode', 11);
    /**
     * TwentyTen functions and definitions
     *
    ...

    Is that the right place?

    For reference, I tried deleting the twentyten functions.php and putting the same file into my child theme and it works normally.

  4. Shadowz
    Member
    Posted 3 years ago #

    well im a php noob aswell, but as for me this is what my line fo code for functions.php is Here

    and really that shouldn't matter where it is in the <?php ?>

    As for the reference yeah that would work, but did you edit a copy of the original default functions.php and put your code into it, as if you were editing it. Then put that edited functions.php in the child theme folder. Then delete the functions.php in the default twentyten theme so there is only one functions.php which will be in the child theme folder.

    haha

  5. niericentral
    Member
    Posted 3 years ago #

    Yes, I did exactly as you suggested and got the results written above (i.e. same results as with child functions.php unfortunately).

    It seems like it would be a major bug if this is normal behavior. So therefore it seems like I must be missing something. Argh.

  6. Root
    Member
    Posted 3 years ago #

    I can't help but I got to agree. I am experiencing a lot of wierdness in child functions.php in the default.

  7. Shadowz
    Member
    Posted 3 years ago #

    Yeah well i guess we will have to work around it for now.

  8. niericentral
    Member
    Posted 3 years ago #

    Just to be clear if anyone else reads this. There is no workaround currently. Any help or suggestions are still appreciated.

  9. Root
    Member
    Posted 3 years ago #

    I hope some one reports this in the trac

  10. elfin
    Moderator
    Posted 3 years ago #

    The functions file in the parent theme stays active, you don't need to copy it to the child theme.

  11. niericentral
    Member
    Posted 3 years ago #

    Thanks for the reply Rich. I think all of us here did that originally as it should be done, but we ended up with white screens and so the whole "delete the original from the parent theme", etc. are attempts at finding a workaround (so far unsuccessful for me).

  12. govpatel
    Member
    Posted 3 years ago #

    @niericentral Check that <?php is first line no blank line before it

    As code posted above seems as if you have blank line and then <?php

  13. niericentral
    Member
    Posted 3 years ago #

    Thanks for the suggestion govpatel. I should have mentioned before that after reading somewhat similar problems I made sure there is no whitespace before or after the simple php code that I pasted above. So specifically, there is no new line/etc. before or after that code.

  14. niericentral
    Member
    Posted 3 years ago #

    Ah! I forgot to mention an important point (I will update the original post) that the code I pasted above does actually work. So I am able to put shortcodes in the titles and they function correctly. It just also causes these other problems.

    edit: It seems I can't edit the original any more? So this will have to do.

Topic Closed

This topic has been closed to new replies.

About this Topic