WordPress.org

Ready to get started?Download WordPress

Forums

blank post.php, categories.php ... any-update-redirect-page.php (18 posts)

  1. bonanza9
    Member
    Posted 5 years ago #

    i'm having the same 'blank page' problems that other wp users have had (every time a post/category/anything else is updated, i am redirected to a blank page). however, despite all my research, i am yet to find a solution.

    i'm currently developing my site 'offline' on my computer. i have no active plugins, i've checked the wp_options database for spam, i've reinstalled wp2.6.2 (bar the wp-content folder), but still no luck.

    any ideas?

    cheers

    b9

  2. Eric Mann
    Member
    Posted 5 years ago #

    What kind of environment are you running on your local machine?

  3. bonanza9
    Member
    Posted 5 years ago #

    im on os x 10.5.4, running mamp 1.7.1 for the php(5) and mysql stuff.
    quite strange really - considering all was well, then suddenly it goes a bit funny.

    also my post editor is playing up - it only displays an html editor (even tho the 'visual' tab is highlighted)?? not sure if that is related to this problem??

    ?

    edit: ARGH! what's going on!? - it seems to be falling apart - wp-admin/ is blank now - i can't login!

  4. Eric Mann
    Member
    Posted 5 years ago #

    I'm wondering if it's a problem with your system. I haven't run into this kind of a problem before, so I don't know what to tell you. Do the blank pages have content when you come back, or are they completely empty? Are you logging activity on your server? Maybe you have something else running that's overwriting the files.

  5. bonanza9
    Member
    Posted 5 years ago #

    thanks for your reply.

    when i edit or write a post, it gets posted correctly; and if i press 'back' the content is there.

    how do i check the server log?

    thanks again

    b9

  6. bonanza9
    Member
    Posted 5 years ago #

    ok - i binned off MAMP and reinstalled it, as well as wordpress.

    i can login now, but still having the problem of blank update pages?!

    post.php, page,php, link.php, categories.php, edit-tags.php...all blank when i add or edit a post, page, link etc...

    edit: i've narrowed it down to be a problem with my theme! i'll let you know exactly what the problem is when i find out!

  7. bonanza9
    Member
    Posted 5 years ago #

    turns out it was a faulty function in functions.php
    any idea what the problem with this is:

    <?php
    function flickr_badge($category_name) {
    $badge_url = 'http://www.flickr.com/badge_code_v2.gne?count=5&display=random&size=s&layout=h&source=user_tag&user=77992252%40N00&tag=' . $category_name;
    $badge_html = file_get_contents($badge_url);
    
    preg_match_all("/<a.*a>/", $badge_html, $match_a); 
    
    foreach($match_a[0] as $div) {
    	echo str_replace("></a>", "/></a>", $div);
    }
    }
    ?>

    ?

    $badge_url is simply an address from flickr that images tagged with $category_name

    cheers

    b9

  8. Eric Mann
    Member
    Posted 5 years ago #

    I've found a similar problem elsewhere in the forums. It looks like some hosts have problems with the file_get_contents() function (some commercial hosts don't have something enabled, your system might be doing the same thing).

    They're solution was to add their own function and then call it instead:

    function my_file_get_contents($url) {
        $ch = curl_init();
        $timeout = 5; // set to zero for no timeout
        curl_setopt ($ch, CURLOPT_URL, $url);
        curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
        $file_contents = curl_exec($ch);
        curl_close($ch);
        return $file_contents;
    }

    Then change the $badge_url line to:
    $badge_html = my_file_get_contents($badge_url);

    You can add the above function directly into the functions.php file of your theme and it should work just fine. Let me know if it doesn't.

  9. bonanza9
    Member
    Posted 5 years ago #

    the function i posted works, but actually whenever i add a second function to functions.php, it breaks wordpress (i get all the problems detailed above)!?

  10. Eric Mann
    Member
    Posted 5 years ago #

    Interesting problem ... can you post your theme functions file for us to look at?

    Use the WP pastebin so we don't take up too much forum space: http://wordpress.pastebin.ca/

  11. bonanza9
    Member
    Posted 5 years ago #

    ok, well i've taken out all the functions i was using, bar one, but for this demonstration, i've included your 'my_file_get_contents()' function:

    http://wordpress.pastebin.ca/1236477

    if i use this functions.php it breaks wp totally.

    edit: i've just tried to include both functions within the same <?php ?> tags and it seems to work ok...for now...

  12. Eric Mann
    Member
    Posted 5 years ago #

    One thing that I see right off the bat is a breaking line in your first function, show_authors(). Your echo statements:

    echo '<li><a href="';
    bloginfo('url');
    echo '/people/#' . $user->first_name .  '">' . $user->first_name . ' ' . $user->last_name . '</a></li>';

    ... will actually end up breaking across multiple lines. I'd recommend replacing it with a single-line echo:
    echo '<li><a href="' . get_bloginfo('url') . '/people/#' . $user->first_name . '">' . $user->first_name . ' ' . $user->last_name . '</a></li>';
    This will prevent your line from breaking and will echo back your

  13. seamlessly. Using get_bloginfo() rather than bloginfo() will also let you display things in-line because it returns data rather than echo it back by itself.

    Of course, if show_authors() is already working just fine for what you need, don't change anything!

    I think including both functions in the same <?php ?> call will help, and you say it's working so far ... Have you tried adding functions back in one at a time to see which one(s) break?

  • bonanza9
    Member
    Posted 5 years ago #

    i tried a single line statement first, and had problems - maybe because of the differences between get_bloginfo() and bloginfo(). it all works like a dream now, even when in separate <?php ?> tags - thanks a lot.

    (i still think its a little wierd that it can break (near enough) the whole system - oh well)

    thanks again

  • Eric Mann
    Member
    Posted 5 years ago #

    I'm glad it's working now! I had a similar problem using bloginfo() in code I had in my header - the whole page seemed to break. I figured it might be a similar issue with your site which is why I recommended the one-line format with get_bloginfo().

    Good luck with everything else!

  • bonanza9
    Member
    Posted 5 years ago #

    it's nice to hear that others have had similar problems!
    thanks so much for your help.

    b9

  • aonghas
    Member
    Posted 5 years ago #

    Hey,

    I think I'm having the same problem here. Can someone tell me how I can solve this problem like he did above please?! I'm not that great with all this coding stuff but simple instructions would be nice!

    Thanks
    Aonghas

  • Eric Mann
    Member
    Posted 5 years ago #

    Aonghas:

    Just like before, post your buggy code into the WordPress pastebin and I'll take a look:

    http://wordpress.pastebin.ca/

    Also, describing the problem you have will help, too ...

  • Fernando Quirino
    Member
    Posted 5 years ago #

    Hi, having a similar problem, but not very good with the php either, can you please help me with it?

    Postedo on the link above, and got this on the functions.php

    http://wordpress.pastebin.ca/1374964

    Is there something you guys can do for me? Thanks

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags