WordPress.org

Ready to get started?Download WordPress

Forums

Twenty Eleven child gives blank screen on Login/Logout (19 posts)

  1. Mpampirina
    Member
    Posted 1 year ago #

    Hello everyone. I have created a simple child theme of Twenty Eleven, with a style.css, a functions.php and a footer.php

    The functions.php is the following:

    <?php
    function childtheme_favicon() { ?>
    <link rel="shortcut icon" href="<?php echo bloginfo('stylesheet_directory') ?>/images/favicon.ico">
    <?php }
    add_action('wp_head', 'childtheme_favicon');
    
    //This is for automatically calculating the copyright years
    
    function comicpress_copyright() {
    	global $wpdb;
    	$copyright_dates = $wpdb->get_results("SELECT
    	YEAR(min(post_date_gmt)) AS firstdate,
    	YEAR(max(post_date_gmt)) AS lastdate FROM $wpdb->posts
    	WHERE post_status = 'publish' ");
    
    	$output = '';
    	if($copyright_dates) {
    		$copyright = "© " . $copyright_dates[0]->firstdate;
    		if($copyright_dates[0]->firstdate != $copyright_dates[0]->lastdate) {
    			$copyright .= '-' . $copyright_dates[0]->lastdate;
    		}
    		$output = $copyright;
    	}
    	return $output;
    }
    ?>

    The footer.php used to have some code for copyrights, but as of now, for testing reasons it is an exact copy of the unedited parent theme.

    So here is the problem.
    If I remove either the footer.php or the functions.php from the child theme, the site works as expected!
    But if those two coexist in the child-theme folder, I get a blank screen of death when I try to logout. If i force logging out by deleting cookies, salt or whatever, I cannot log back in the dashboard, getting a blank screen once again. Tried different browsers with the same results, and debugging mode is active but I got no messages whatsoever.
    The site is hosted on bluehost.

    Any ideas, please?

  2. BH_WP_Guru
    Member
    Posted 1 year ago #

    When you get the blank screen, did you check the error logs in your Bluehost cPanel? (in Error Logs, scroll down to the php logs).
    You also can edit the php.ini file to set "display_errors=On" if you want them to possibly show the error to anyone that visits that blank page on your site.

  3. Mpampirina
    Member
    Posted 1 year ago #

    Hello there.
    Hm, I'm checking it now and it's a chaos. Newer and older error logs from different sites I have there,they are all messed together. I wonder if I can reset the log, to be sure which errors cause the problem. Thank you for your suggestion.

  4. bhpress
    Member
    Posted 1 year ago #

    The errors logs are stored in each folder that causes the error. If you delete the error_log folder it will clean those up for you.

  5. Mpampirina
    Member
    Posted 1 year ago #

    Thanks.
    I deleted the error_log in the folder of the problematic site. Then renamed my functions.php.bk back to functions.php to recreate the crashing. When I tried to logout of the site, the blank screen happened as expected, though there was no new error_log created.

    Then I created an empty error_log with the proper permissions, as I thought that this might be the problem... Tested once again logging out, I got the blank screen, but still nothing in the error_log.

    So I guess this way is a dead end.. no?

    By the way, when the blank screen happens, the URL in the browser shows something like this:
    http://www.mysite.com/wp-login.php?action=logout&_wpnonce=7cf8f6454e

    while when all goes well, the URL after logging out is:
    http://www.mysite.com/wp-login.php?loggedout=true

    Can we assume anything from that?

  6. bhpress
    Member
    Posted 1 year ago #

    You can open your wp-config.php and change the:

    define(‘WP_DEBUG’, false);

    to

    define(‘WP_DEBUG’, true);

    That will make it display the errors on the screen.

  7. Mpampirina
    Member
    Posted 1 year ago #

    bhpress, that is exactly what I did earlier, when I said

    ...and debugging mode is active but I got no messages whatsoever

  8. esmi
    Forum Moderator
    Posted 1 year ago #

    as of now, for testing reasons it is an exact copy of the unedited parent theme.

    You cannot copy the parent's functions.php into the child! Empty your child'#s functions.php file.

  9. Mpampirina
    Member
    Posted 1 year ago #

    Read again.

    The footer.php used to have some code for copyrights, but as of now, for testing reasons it is an exact copy of the unedited parent theme.

    Only the footer.php is an exact copy. The functions.php is what I posted on a code block in my initial post

  10. Mpampirina
    Member
    Posted 1 year ago #

    That's why i 'm so curious to know if anybody has any idea that can help.

    The file 'functions.php' has just two mere functions, one for a favicon, and one to calculate the copyright years.

    And footer.php is an exact copy of the parent theme, just to make sure I haven't created a bug myself in the code.

    But if I remove any of the two files from the child-theme folder, the site works fine. Otherwise, I get a blank screen of death on logout.

    The debugging mode is on, in wp-config.php yet I see no errors on the screen. Just the blank screen. Also the error_log file in my host (bluehost) is completely empty...

    It's unexplainable. I think, I'm loosing my mind here! o_o

  11. esmi
    Forum Moderator
    Posted 1 year ago #

    if I remove any of the two files from the child-theme folder, the site works fine.

    Then the issue is in your custom functions - probably comicpress_copyright().

  12. Mpampirina
    Member
    Posted 1 year ago #

    Good thought, but no. I suspected that one of the functions might be bugged, so I removed comicpress_copyright and tested the site again.

    Blank Screen.

    Then I put back that function and remove the favicon one. Tested again
    ...and got blank screen.

    Then I removed both the functions, and I just left the opening and closing tags of the file <?php and ?> . Tested again and guess what....
    Blank screen!!!!!

    So it's not the custom functions causing the problem. It's something else, but what the heck is it?

  13. emidac
    Member
    Posted 1 year ago #

    I was having this same problem, using a child theme of twentyeleven and getting a black screen for my dashboard login at wp-admin (specifically http://www.blacklungbeats.com/wp-admin).

    Then I went into FTP on BlueHost and noticed that I was missing the folder for original twentyeleven theme itself so I downloaded that new and unzipped it into my FTP. I also took a look at the error logs. Something was messed up with a plugin "W3TotalCache" so I disabled that.

    Now I'm back to the problem from earlier today where not only do I get a blank screen when trying to login, but even my plain website itself is totally crashed and I just see a list of links for some .shtml files and the title of my page on top has turned into "Index of /"

    Please please help! It would be much appreciated. I'm also looking to potentially pay someone if they can consult on my site for an hour. I've had so so many frustrating issues since my wordpress site worked back in July and then all of a sudden lost all of its formatting out of nowhere on day. I've tried to diagnose my original error and after weeks and weeks to no avail, I just uninstalled and reinstalled and now am encountering even more errors that when I first began, and you'd think I only go faster the second time around after learning how things work.. :\

  14. esmi
    Forum Moderator
    Posted 1 year ago #

    @emidac: It is impolite to interrupt another poster's ongoing thread with a question of your own and it causes significant problems for the forum's volunteers. Please post your own topic.

    @Mpampirina: What happens if you keep functions.php empty and also remove footer.php?

  15. emidac
    Member
    Posted 1 year ago #

    @esmi, idk if you wrote this forum's code of etiquette but....

    Generally if you make a new post about a problem that is already being addressed on a different thread, people direct you to the other post and ask why you felt so special as to make your own. It's also more efficient to solve two of the SAME problems at the same time.

    I've noticed many times on this forum where people who experience the SAME problem indicate this on the same thread so it helps people diagnosing that problem to better understand it.

  16. esmi
    Forum Moderator
    Posted 1 year ago #

    Are you using the same version of WordPress on the same physical server hosted by the same hosts with the same plugins, theme & configurations as the original poster?

    No? Then your problem - despite any similarity in symptoms - is likely to be completely different. So please help us to help you and post a new topic when we ask you to.

  17. Mpampirina
    Member
    Posted 1 year ago #

    @esmi Interesting approach. I tried what you suggested. With functions.php empty (only <?php ?> inside) and the footer gone, the site crashes on logout, giving a blank screen. I expected it to work, but it crashes. No errors on logs so far.

  18. esmi
    Forum Moderator
    Posted 1 year ago #

    Then it sounds like the theme isn't the issue. Have you tried:

    - deactivating all plugins to see if this resolves the problem. If this works, re-activate the plugins one by one until you find the problematic plugin(s).

    - resetting the plugins folder by FTP or PhpMyAdmin. Sometimes, an apparently inactive plugin can still cause problems.

    - re-uploading all files & folders - except the wp-content folder - from a fresh download of WordPress.

  19. Mpampirina
    Member
    Posted 1 year ago #

    The problem is solved. I did deactivate and re-activate all my plugins, with testing after each reactivation. The thing is I didn't find which plugin caused the initial problem, though I reactivated all of them. Oh well.

    Thank you for your support, everybody.

Topic Closed

This topic has been closed to new replies.

About this Topic