Grow your CSS skills. Land your dream job.

[Solved] My footer just disappeared in PHP land

  • # August 2, 2009 at 1:02 am

    If I add a closing div between #push and #footer and remove the extra closing div between the form and the sidebar the pages validate:

    Code:

    That closes the page wrapper, and then just add this to the stylesheet:

    Code:
    #footer {
    width: 100%;
    }
    # August 2, 2009 at 10:38 am

    hey apostrophe,

    this has appeared to solve the problem in Firefox and Chrome. the only issue is that on a NON-commented single.php page I am getting the sidebar showing up at the bottom of the page and footer appearing within the sidebar DIV with a 300px width. when i take out the ‘width:100%;’ footer code, I solve the problem there and then the whole site is looking perfect.

    the problem is when i look at the site in IE 7.0.6 the NON-commented single.php page does not display properly. When I have the ‘width:100%’ footer code included it displays the sidebar right above the footer. the footer is displayed with a 1000px width only. additionally when I take out the ‘width:100%’ footer code the page displays with the sidebar at the bottom and the footer in the sidebar DIV with a 300px width (just like it was displaying in Firefox and Chrome).

    so this is nuts. one problem gets solved only to create a new problem, then again I never checked out how IE was displaying my page as I am not the biggest fan of it but still many people use it. anyways I hope there is a fix for this.

    take care,
    adam

    # August 2, 2009 at 11:07 am

    oh wait a second, the NON-commented single.php page is displaying wrongly with and without that width:100% footer code. i could have sworn I saw it appear correctly before. i even cleared my cache. i will check it later.

    # August 2, 2009 at 12:16 pm

    Go through your files and comment every closing div so that you can see which closing tag goes with which div. Then you will find your problem.

    # August 3, 2009 at 11:58 am
    "apostrophe" wrote:
    Go through your files and comment every closing div so that you can see which closing tag goes with which div. Then you will find your problem.

    Ok I did what you suggested and discovered that it was the <div class="comments"> div that was screwing my NON-commented single.php page up so I took out that DIV from the comments.php file and all pages display correctly now. The problem is that now I am not able to style this piece of code from the comments.php file:

    Code:
    < ?php if ( have_comments() ) : ?>

    < ?php comments_number('no comments', '1 comment', '% comments' );?>

    Another thing that is funny is that when a post has no comments, the code above does not display "no comments" as it should. On posts with comments it displays ’1 comment’ or ’2 comments’ as it should. so this bit is a bit annoying.

    Also when I placed <div class="comments"> </div> around the above PHP code that it created a DIV around the <div id="respond"></div> (which contains the comment form) on NON-commented single.php pages. But on COMMENTED single.php pages the <div class="comments"> </div> surrounds only the "1 comment" and "2 comment" H3 text. So I am thinking that some code deeper in the PHP is screwing up the way my page is displaying. Specifically it would be a piece of PHP code that is not displaying the text "no comments" as well as wrapping the ‘comments’ DIV around the ‘respond’ DIV.

    i have decided to leave the <div class="comments"> </div> around the above PHP code in order to better demonstrate to you what is going on. Also I have colored every DIV on my page so you can see better what is going on too. The comments DIV you will see to be orange with a green outline. Also, on the single.php page http://criticall.co.cc/?p=4 the pagewrap DIV is not reaching the footer DIV and jsut stops half way down the page.

    take care,
    adam

    PS here is the comments.php code:

    Code:
    < ?php
    /**
    * @package WordPress
    * @subpackage Default_Theme
    */

    // Do not delete these lines
    if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
    die ('Please do not load this page directly. Thanks!');

    if ( post_password_required() ) { ?>

    enter the password to view comments

    < ?php
    return;
    }
    ?>

    < ?php if ( have_comments() ) : ?>

    < ?php comments_number('no comments', '1 comment', '% comments' );?>

      < ?php wp_list_comments(); ?>

    < ?php else : // this is displayed if there are no comments so far ?>

    < ?php if ('open' == $post->comment_status) : ?>

    < ?php else : // comments are closed ?>

    Comments are closed.

    < ?php endif; ?>
    < ?php endif; ?>

    < ?php if ('open' == $post->comment_status) : ?>

    < ?php comment_form_title( 'post a comment', 'post a comment to %s' ); ?>

    < ?php cancel_comment_reply_link(); ?>

    < ?php if ( get_option('comment_registration') && !$user_ID ) : ?>

    You must be /wp-login.php?redirect_to=< ?php echo urlencode(get_permalink()); ?>“>logged in to post a comment.

    < ?php else : ?>

    /wp-admin/profile.php”>< ?php echo $user_identity; ?>. ” title=”Log out of this account”>Log out »

    < ?php else : ?>

    />

    />

    website

    < ?php endif; ?>

    # August 3, 2009 at 12:33 pm

    Well, the most obvious thing I see there is:

    Code:

    < ?php if ( have_comments() ) : ?>

    < ?php comments_number('no comments', '1 comment', '% comments' );?>

    Should be :

    Code:
    < ?php if ( have_comments() ) : ?>

    < ?php comments_number('no comments', '1 comment', '% comments' );?>

    # August 3, 2009 at 2:47 pm

    interesting, the display problem has been solved. the "pagewrap" DIV shoots all the way to the footer now and the "respond" DIV is not encased in the "comments" DIV. thanks a bunch apostrophe : ) !

    do you have any clue as to why on the NON-commented single.php page it is not displaying "no comments"?

    thanks again and take care,
    adam

    # August 3, 2009 at 3:27 pm
    Quote:
    do you have any clue as to why on the NON-commented single.php page it is not displaying "no comments"?

    Tbh, no I don’t have a clue. Are you using any kind of comments plugin?

    # August 3, 2009 at 4:26 pm
    "apostrophe" wrote:
    Tbh, no I don’t have a clue. Are you using any kind of comments plugin?

    No I am not using a comments plug in. It bothers me that it will not say ‘no comments’ only because it is not behaving as the program is intended to. i really do not care if it does not say it. but still. it should be performing. i think it is a deep PHP issue. what else could it be?

    do you knwo any site or set of tutorials that goes through the word press PHP code line by line explaining what all of it does?

    # August 4, 2009 at 4:30 am

    Well there’s a simple test. Just switch to the default theme, if it’s working there then you know the problem is somewhere in your code.

    # August 4, 2009 at 10:44 am
    "apostrophe" wrote:
    Well there’s a simple test. Just switch to the default theme, if it’s working there then you know the problem is somewhere in your code.

    Hey again, well it seems with the WordPress Default 1.6 Theme, it does not display "no comments" but on the "WordPress Classic 1.5" it does actually display "No comments" so the code must be somewhere deeper in the PHP.

    Thanks for your help again :)

    Take care,
    Adam

    # August 4, 2009 at 12:12 pm

    Ok, this is untested but let’s move that ‘if’ statement:

    Code:

    < ?php comments_number('no comments', '1 comment', '% comments' );?>

    < ?php if ( have_comments() ) : ?>

      < ?php wp_list_comments(); ?>

    NB I only just noticed that you have <div class="navigation"> twice, once before the comments list and once after, is that right?

    # August 4, 2009 at 12:52 pm

    Yes! "No Coments" now shows! Excellent work apostrophe :)

Viewing 13 posts - 16 through 28 (of 28 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".