WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Whitescreen WP Login with Child Theme functions.php file (20 posts)

  1. skipper0802
    Member
    Posted 2 years ago #

    Why is it that when I have a functions.php file loaded to the child theme folder I cannot logon? Doesn't the child functions.php file run after the parent file? (Tested with the Jigoshop plugin activated and deactivated when this happens.) After I click the login button the action hangs as in this screen pic.

    Our website.

    This child theme folder's functions.php file hook are supposed to help us wrap the Jigoshop v1.2.3 cart in our Creativix theme. In this file I've been trying to locate the correct div IDs to wrap the cart per the threads elsewhere. Here's the Jigoshop system info.

    When I remove the file from the child folder, I can logon with no problem.

  2. Krishna
    Volunteer Moderator
    Posted 2 years ago #

    Please try to login HERE

  3. skipper0802
    Member
    Posted 2 years ago #

    Hi Krishna, and thx for responding. I re-loaded the aforementioned file before trying your login link...same whitescreen response. I removed the file, and tried your link...and was able to login. However, the file was not in place. Thoughts?

  4. Krishna
    Volunteer Moderator
    Posted 2 years ago #

    Wp-creativix was last updated on 2012-01-17 and may not be compatible with WP 3.4

    Anyway, you may do the following:
    1. Check whether you have the unedited parent theme in the themes directory
    2. Go to the WordPress theme repository and download a fresh copy of the theme (from: http://wordpress.org/extend/themes/wp-creativix) and replace the old parent theme with it
    3. If it does not work go to the theme’s webpage and download a copy and try it.

  5. skipper0802
    Member
    Posted 2 years ago #

    Hello Krishna,
    Some good ideas...I'll try them when I return home in a short while. I'll update here with my results. Thx!

  6. skipper0802
    Member
    Posted 2 years ago #

    Tried this:

    1. Re-loaded child functions.php file for Jigoshop wrapping.
    2. Downloaded parent theme .zip file from WordPress.org theme bank
    3. Un-zipped and FTP'd to host directory
    4. Attempted to logon with regular link...response same
    5. Atempted to logon with your link above...response same
    6. Examined the author's theme file (to download). It is version 1.5.3 so I don't think I want to do that.

    Is it possible that the child theme .php files execute before parent theme files? If so, isn't there a way to do an "include" into the child file file and call the contents of the parent functions.php file?

  7. skipper0802
    Member
    Posted 2 years ago #

    I think this condition is the source of the problem: the child theme functions.php file loads first then the parent theme's functions.php file.

    Thread at:

    For functions.php: You can have a functions.php in your child theme containing just the extra bits you want to add. WordPress loads both functions.php files. First the child’s, then the parent’s.

    I'm going to read more about the php code structure for "include" and "require".

    Thoughts?

  8. skipper0802
    Member
    Posted 2 years ago #

    Maybe something like this for my child functions.php file?. Basically, this should prepend the contents of the parent file:

    <?php
    /* this line prepends the parent functions file content */
    include '/wp-creativix/functions.php';
    
    /* the following code runs after the parent theme code lines in order to wrap the Jigoshop cart */
    
    function mytheme_open_jigoshop_content_wrappers()
    {
        echo '<div class="content"><div class="sidebar"><div class="footer">';
    }
    
    function mytheme_close_jigoshop_content_wrappers()
    {
        echo '</div></div></div>';
    }
    
    function mytheme_prepare_jigoshop_wrappers()
    {
        remove_action( 'jigoshop_before_main_content', 'jigoshop_output_content_wrapper', 10 );
        remove_action( 'jigoshop_after_main_content', 'jigoshop_output_content_wrapper_end', 10);
    
        add_action( 'jigoshop_before_main_content', 'mytheme_open_jigoshop_content_wrappers', 10 );
        add_action( 'jigoshop_after_main_content', 'mytheme_close_jigoshop_content_wrappers', 10 );
    }
    add_action( 'wp_head', 'mytheme_prepare_jigoshop_wrappers' );
    ?>

    Buuuut: since WP runs both files (child file first). What happens when the second (parent) functions file runs? Crashola?

  9. skipper0802
    Member
    Posted 2 years ago #

    Hmm. I tried the above include statement in the child functions.php file. It didn't crash the site, but the result was the same...whitescreen at logon attempt.

    Quite puzzling.

    Ideas anyone?

  10. Krishna
    Volunteer Moderator
    Posted 2 years ago #

    @skipper0802,
    Apparently, everything is OK without the child theme's functions.php file is it not? Now can you tell me if you can go without that and what problems do you face? I ask this just because WP, the theme you are using and the plugin for which you need to revise the functions file are just either updated or the authors just provided temporary fixes, or may be needing updating. As you might have checked, the theme and plugins were last updated much before WP 3.4 was released. So apparently something is causing problem for the other.
    As the tests so far show, the plugin is the root cause. Can you try some other plugin in place of that?

    Please try some of these options.

  11. skipper0802
    Member
    Posted 2 years ago #

    Krishna,
    Yes, all is OK without the child functions.php present in the child folder. If I go without I am not certain how to wrap the shopping cart app in the Creativix child theme.

    Can you try some other plugin in place of that?

    Do you mean a different shopping cart plugin? I have screened a few other cart apps--none have the features that we want like Jigoshop does. On the other hand there's compromise.

    I'll look for other cart plugins and post the results here. Thanks Krishna.

    Regards,
    Eric & Barb

  12. Krishna
    Volunteer Moderator
    Posted 2 years ago #

    You are welcome!

  13. skipper0802
    Member
    Posted 2 years ago #

    The include structure is not going to work...that call would have to originate from the parent functions.php file. Rather negating the reason of using a child theme.

  14. skipper0802
    Member
    Posted 2 years ago #

    Yes, all is OK without the child functions.php present in the child folder.

    I should note that I can leave the Jigoshop plugin activated without issue. It is only when the child theme functions.php file is present in the child theme folder that I have the logon problem.

  15. Krishna
    Volunteer Moderator
    Posted 2 years ago #

    I think that may be a better option.

  16. skipper0802
    Member
    Posted 2 years ago #

    Would this work? (Named as jigoshop_wrap.php in the child theme folder.) This filename does not match anything in the parent theme therefore it should run after all other files?

    <?php
    $file = '/wp-content/themes/wp-creativix/functions.php';
    
    // The new lines to append to the functions.php file are within wrap.txt
    $appendlines = file_get_contents('wrap.txt');
    
    /* using the FILE_APPEND flag to append the content to the end of the file and the LOCK_EX flag to prevent anyone else writing to the file at the same time */
    
    // Write the contents to the file
    file_put_contents($file, $appendlines, FILE_APPEND | LOCK_EX);
    
    ?>

    The binary addition of "LOCK_EX" is probably superfluous.
    Thoughts?

  17. skipper0802
    Member
    Posted 2 years ago #

    For now I just manually appended the code lines (hooks) to wrap Jigoshop in the Creativix theme. (No problems noted with login.)

    This is not the solution I wanted as the next time I update the parent theme I'll have to remember to append the code lines again. That is, until I can determine why having the above particular child functions file in the child theme folder causes the issue with the login.

    My theory is that since the child theme functions.php file runs before the parent file, and that the child functions.php file is not a complete functions.php file; it breaks the login process. The evidence is anecdotal at this point. I'm not a strong-enough PHP coder to trace/trap the error.

    I'll mark this as resolved until more can be understood about this.

    Thanks to all,
    Eric

  18. skipper0802
    Member
    Posted 2 years ago #

  19. heathenjimmy
    Member
    Posted 1 year ago #

    The divs are opened in header.php and closed in footer.php of your parent theme.
    You can copy both files to your child theme and add your necessary divs and classes. The child theme files will replace the parent files so you can update the parent theme and retain your changes in the child theme.

    Editing functions.php is the long way around for your purpose. You could also make a single-page.php and call a different header and footer for your divs.
    I guess you've seen this page.
    http://codex.wordpress.org/Theme_Development

  20. nickandrea19
    Member
    Posted 1 year ago #

    I followed some advice from this post http://wordpress.org/support/topic/functionsphp-on-twentyten-child-theme-causes-blank-pages-mu-setup?replies=24 and removed any returns after the closing PHP tag. This fixed the problem. That finicky PHP...

Topic Closed

This topic has been closed to new replies.

About this Topic