WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Whitescreen WP Login with Child Theme functions.php file

[Resolved] Whitescreen WP Login with Child Theme functions.php file

  • 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.

Viewing 15 replies - 1 through 15 (of 19 total)
  • Please try to login HERE

    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?

    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.

    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!

    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?

    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?

    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?

    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?

    @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.

    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

    You are welcome!

    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.

    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.

    I think that may be a better option.

    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?

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘[Resolved] Whitescreen WP Login with Child Theme functions.php file’ is closed to new replies.
Skip to toolbar