treehouse : what would you like to learn today?
Web Design Web Development iOS Development

[Solved] My footer just disappeared in PHP land

  • Hi everyone,

    I was doing fine with customizing my WordPress blog today. I was just fine tuning some code in my index.php & style.css files (didn't even touch the footer) when all of a sudden I noticed my footer DIV went bye bye. I was messing around with some code in the index.php file but only related to the .comment DIV One of the last things I remember tweeking was some code related to the ".comment" div in the style.css file and the very last thing I remember doing was editing the ".searchbutton" div (i had gotten rid of the "text-indent:-9999px" so the text "search" would show up in the button).

    The URL of my blog is:

    http://criticall.co.cc/

    Here is the index.php code:

    <?php get_header(); ?>

    <div id=\"content\">

    <div id=\"contentpadding\">

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

    <?php while (have_posts()) : the_post(); ?>

    <div <?php post_class() ?> id=\"post-<?php the_ID(); ?>\">
    <h2><a href=\"<?php the_permalink() ?>\" rel=\"bookmark\" title=\"Permanent Link to <?php the_title_attribute(); ?>\"><?php the_title(); ?></a></h2>

    <div class=\"date\">

    <?php the_time('l, F jS, Y') ?> <!-- by <?php the_author() ?> -->

    </div>

    <div class=\"metadata\">

    Posted in <?php the_category(' / ') ?>

    </div>

    <div class=\"clear\"></div>

    <?php the_content('read more... &raquo;'); ?>

    <div class=\"tags\">

    <p class=\"postmetadata\"><?php the_tags('Tags: ', ' / ', '<br />'); ?>

    </div>

    <div class=\"comments\">

    <?php comments_popup_link('comment', '1 comment', '% comments'); ?></p>

    </div>



    <?php endwhile; ?>

    <div class=\"navigation\">

    <div><?php next_posts_link('&laquo; Older Entries') ?></div>

    <div><?php previous_posts_link('Newer Entries &raquo;') ?></div>

    </div>

    <?php else : ?>

    <h2 class=\"center\">Not Found</h2>

    <p class=\"center\">Sorry, but you are looking for something that isn't here.</p>

    <?php get_search_form(); ?>

    <?php endif; ?>

    </div>

    </div>

    <?php get_sidebar(); ?>

    <?php get_footer(); ?>


    Here is my style.css code:

    /*
    criticall
    http://criticall.co.cc/

    Highlite Blue: #0066ff
    Black Text: #000000
    Middle Gray: #666666
    */





    /*
    RESET
    */
    * {margin:0; padding:0;}
    html {overflow-y: scroll;}
    html,body {height:100%}
    body {font-size: 12px; font-family:Arial, san-serif; color: #000000;
    background: url(/images/topbar-background.png) top center repeat-x white;}





    /*
    UTILITY
    */
    .floatleft {float: left;}
    .floatright {float: right;}
    .clear {clear: both;}


    a {color:#0066ff; text-decoration: none; }
    a:hover { color:#0066ff; background: #eeeeee; border-bottom:1px dotted #0066ff;} a h1:hover { color:#0066ff;}

    h1 {color:#666666; font-size: 3em; font-weight: normal;}
    h2 {color:#666666; font-size: 2em; font-weight: normal;}
    h3 {color:#666666; font-size: 1.5em; font-weight: normal;}




    /*BLOG POSTS*/
    .date {
    color:#666666;
    font-size:10px;
    float:left;
    text-transform: lowercase;
    padding:0 0 15px 0;
    }

    .metadata {
    color:#666666;
    font-size:10px;
    float:right;
    text-transform: lowercase;
    padding:0 0 15px 0;
    }

    .tags {
    color:#666666;
    font-size:10px;
    float:left;
    text-transform: lowercase;
    padding:15px 0;
    }

    .comments a {
    border: 0px solid;
    outline: none;
    display:block;
    width:100px;
    height:48px;
    outline: none;
    background: url(/images/comment-button.png) 0 0 no-repeat;
    color:#0066ff;
    font-size:10px;
    float:right;
    text-transform: lowercase;
    background-position: 0px -48px;
    font-weight: bold;
    }

    .comments a:hover
    {
    background-position: 0px 0px;
    color:#ffffff;
    }






    /*
    STRUCTURE
    */
    #pagewrap {
    width: 1000px;
    margin: 0px auto -100px;
    min-height: 100%;
    height: auto !important;
    height: 100%;
    }

    #push {
    height: 100px;
    }


    #content
    {
    width: 700px;
    float: left;
    background: #fff;
    }

    #contentpadding
    {padding: 20px}




    #sidebar
    {
    width: 300px;
    float:right;
    }

    #sidebarpadding
    {
    padding: 20px 20px 20px 65px;
    }





    /*
    FOOTER
    */
    #footer {
    height:100px;
    background: #eeeeee;
    }

    #footerguts {
    width: 1000px;
    margin: 0 auto;
    }





    /*
    HEADER
    */

    h1#logo a
    {
    outline: none;
    text-indent: -9999px ;
    display:block;
    width:256px;
    height:83px;
    background: url(/images/title-button.png) top left no-repeat;
    text-margin:0 10px 8px 0;
    float:left;
    }

    h1#logo a:hover
    {
    background-position: 0px -83px;
    background-color: #d2e4ff;
    }

    #header
    {
    height: 89px;
    width: 100%;
    margin:0 auto;
    position:relative;
    }

    #header div
    {
    float:left;
    }

    #header p
    {
    text-indent: -9999px;
    }

    #about a
    {
    border: 0px solid;
    outline: none;
    text-indent: -9999px;
    display:block;
    width:106px;
    height:83px;
    background: url(/images/about-button.png) 0 0 no-repeat;
    position:absolute;
    top:0px;
    left:400px;
    }

    #about a:hover
    {
    background-position: 0px -83px;
    background-color: #d2e4ff;
    }


    #contact a
    {
    border: 0px solid;
    outline: none;
    text-indent: -9999px;
    display:block;
    width:134px;
    height:83px;
    background: url(/images/contact-button.png) 0 0 no-repeat;
    position:absolute;
    top:0px;
    left:515px;
    }

    #contact a:hover
    {
    background-position: 0px -83px;
    background-color: #d2e4ff;
    }

    #rss a
    {
    border: 0px solid;
    outline: none;
    text-indent: -9999px;
    display:block;
    width:50px;
    height:83px;
    background: url(/images/rss-button.png) 0 0 no-repeat;
    position:absolute;
    top:0px;
    left:658px;
    }

    #rss a:hover
    {
    background-position: 0px -83px;
    background-color: #d2e4ff;
    }




    /*
    SEARCH FORM
    */
    form#searchform
    {
    display:block;
    width:255px;
    height:20px;
    position:absolute;
    top:56px;
    left:753px;
    }

    .searchbutton
    {
    color: #0066ff;
    border: 0px solid;
    display:block;
    width:45px;
    height:20px;
    background: #d2e4ff;
    position:absolute;
    top:0px;
    left:202px;
    -moz-border-radius-bottomright: 4px;
    -moz-border-radius-topright: 4px;
    -webkit-border-bottom-right-radius: 4px;
    -webkit-border-top-right-radius: 4px;
    font-size: 12px;
    }

    .searchbutton:hover
    {
    background-color: #0066ff;
    color: #ffffff;
    font-size: 12px;
    }

    .searchfield
    {
    background:url(/images/search-field-shadow.png) top left repeat-x #666666;
    color: #eeeeee;
    border: 0px solid;
    position: absolute;
    top:0px;
    left:0px;
    display:block;
    width:200px;
    height:20px;
    -moz-border-radius-bottomleft: 4px;
    -moz-border-radius-topleft: 4px;
    -webkit-border-bottom-left-radius: 4px;
    -webkit-border-top-left-radius: 4px;
    font-size: 12px;
    }


    I will also post the header and footer files for good measure.

    header.php


    <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
    <html xmlns=\"http://www.w3.org/1999/xhtml\" <?php language_attributes(); ?>>

    <head profile=\"http://gmpg.org/xfn/11\">

    <meta http-equiv=\"Content-Type\" content=\"<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>\" />

    <title><?php wp_title('&laquo;', true, 'right'); ?> <?php bloginfo('name'); ?></title>

    <link rel=\"stylesheet\" href=\"<?php bloginfo('stylesheet_url'); ?>\" type=\"text/css\" media=\"screen\" />
    <link rel=\"alternate\" type=\"application/rss+xml\" title=\"<?php bloginfo('name'); ?> RSS Feed\" href=\"<?php bloginfo('rss2_url'); ?>\" />
    <link rel=\"alternate\" type=\"application/atom+xml\" title=\"<?php bloginfo('name'); ?> Atom Feed\" href=\"<?php bloginfo('atom_url'); ?>\" />
    <link rel=\"pingback\" href=\"<?php bloginfo('pingback_url'); ?>\" />

    <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>

    <?php wp_head(); ?>

    </head>

    <body>

    <div id=\"pagewrap\">

    <div id=\"header\">

    <h1 id=\"logo\">
    <a href=\"<?php echo get_option('home'); ?>/\"><?php bloginfo('name'); ?></a>
    </h1>

    <p><?php bloginfo('description'); ?></p>

    <div id=\"about\">
    <a href=\"http://criticall.co.cc/about/\">about</a>
    </div>

    <div id=\"contact\">
    <a href=\"http://criticall.co.cc/contact/\">contact</a>
    </div>

    <div id=\"rss\">
    <a href=\"<?php bloginfo('rss2_url'); ?>\">rss</a>
    </div>

    <?php get_search_form(); ?>

    </div>



    footer.php

    			<div class=\"clear\"></div>

    <div id=\"push\"></div>

    </div>

    <div id=\"footer\">

    <div id=\"footerguts\">

    <p>
    <a href=\"<?php bloginfo('rss2_url'); ?>\">Entries (RSS)</a> and <a href=\"<?php bloginfo('comments_rss2_url'); ?>\">Comments (RSS)</a>.
    <!-- <?php echo get_num_queries(); ?> queries. <?php timer_stop(1); ?> seconds. -->
    </p>

    </div>

    </div

    <?php wp_footer(); ?>

    </body>

    </html>


    If you need anymore information or have any questions then let me know and I will provide. Thank you so much!
  • Looks like you are missing a sidebar too. Are you using any plugins? Are the footer and sidebar still absent if you switch back to the default theme?
  • is the footer & sidebar in the proper directory?

    also looking at your footer code, looks like your trying to call the footer in the footer, take out the <?php wp_footer(); ?> within the footer
  • "ikthius" said:
    is the footer & sidebar in the proper directory?

    also looking at your footer code, looks like your trying to call the footer in the footer, take out the <?php wp_footer(); ?> within the footer


    Hi ikthius,

    Yes the footer and sidebar are located in my theme folder along with all the other .php files you'd expect in a default WP theme.
    I have taken out the <?php wp_footer(); ?> in the footer.php file but to no avail.

    "apostrophe" said:
    Looks like you are missing a sidebar too. Are you using any plugins? Are the footer and sidebar still absent if you switch back to the default theme?


    Hi apostrophe,

    Yes, I was focusing so much on my footer that I forgot to mention that the side bar is not showing either. I actually am using the default Akismet 2.2.3 plug-in but that code does not show up in the side bar. In fact, my side bar is rather bare, code wise.

    Here is the side bar code:


    <div id=\"sidebar\">

    <div id=\"sidebarpadding\">

    <h2>archives</h2>
    <ul>
    <?php wp_get_archives('type=monthly'); ?>
    </ul>
    </li>

    <?php wp_list_categories('show_count=1&title_li=<h2>categories</h2>'); ?>

    <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>



    <?php } ?>

    <?php endif; ?>


    </div>

    </div>

    UPDATE:
    I should also mention that I made an adjustment to my footer.php code with a friend's help. They found an unclosed ending DIV tag that looked like " </div ". So I corrected that along with ikthius's suggestion of removing the footer call function code " <?php wp_footer(); ?> ".

    Here is the updated footer.php code:

                 <div class=\"clear\"></div>

    <div id=\"push\"></div>

    </div>

    <div id=\"footer\">

    <div id=\"footerguts\">

    <p>
    <a href=\"<?php bloginfo('rss2_url'); ?>\">Entries (RSS)</a> and <a href=\"<?php bloginfo('comments_rss2_url'); ?>\">Comments (RSS)</a>.
    <!-- <?php echo get_num_queries(); ?> queries. <?php timer_stop(1); ?> seconds. -->
    </p>

    </div>

    </div>

    </body>

    </html>


    Thanks for the help so far.
  • Are you definitely using index.php as your home page or have you set a wp page? If you click on comments and go to single.php then the footer shows.
  • "apostrophe" said:
    Are you definitely using index.php as your home page or have you set a wp page? If you click on comments and go to single.php then the footer shows.


    I am certain index.php is my homepage because i just changed some code around, uploaded it and then refreshed http://criticall.co.cc/ and the change manifested. Not sure what a WP page is.

    You are right. The footer shows on single pages. Thanks for pointing that out.
  • Not sure what a WP page is.

    So you are using posts for your about and contact pages? :?

    You are right. The footer shows on single pages. Thanks for pointing that out.

    So what have you done different in single.php to index.php?
  • "apostrophe" said:
    Not sure what a WP page is.

    So you are using posts for your about and contact pages? :?


    Oh duh. WP page. Yes now I know what that is. I use WP pages for my "about" and "contact" pages.

    [quote]You are right. The footer shows on single pages. Thanks for pointing that out.

    So what have you done different in single.php to index.php?[/quote]

    That is the tricky part. I have to sift through the code and cross reference. I am on that now. The answer must be there. If not, at least a major clue.

    Here is the "single.php" page code:

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

    get_header();
    ?>

    <div id=\"content\">

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    <div class=\"navigation\">
    <div><?php previous_post_link('&laquo; %link') ?></div>
    <div><?php next_post_link('%link &raquo;') ?></div>
    </div>

    <div <?php post_class() ?> id=\"post-<?php the_ID(); ?>\">
    <h2><?php the_title(); ?></h2>

    <div class=\"entry\">
    <?php the_content('<p class=\"serif\">Read the rest of this entry &raquo;</p>'); ?>

    <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    <?php the_tags( '<p>Tags: ', ', ', '</p>'); ?>

    <p class=\"postmetadata alt\">
    This entry was posted
    <?php /* This is commented, because it requires a little adjusting sometimes.
    You'll need to download this plugin, and follow the instructions:
    http://binarybonsai.com/archives/2004/08/17/time-since-plugin/ */
    /* $entry_datetime = abs(strtotime($post->post_date) - (60*120)); echo time_since($entry_datetime); echo ' ago'; */ ?>
    on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?>
    and is filed under <?php the_category(', ') ?>.
    You can follow any responses to this entry through the <?php post_comments_feed_link('RSS 2.0'); ?> feed.

    <?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
    // Both Comments and Pings are open ?>
    You can <a href=\"#respond\">leave a response</a>, or <a href=\"<?php trackback_url(); ?>\" rel=\"trackback\">trackback</a> from your own site.

    <?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
    // Only Pings are Open ?>
    Responses are currently closed, but you can <a href=\"<?php trackback_url(); ?> \" rel=\"trackback\">trackback</a> from your own site.

    <?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
    // Comments are open, Pings are not ?>
    You can skip to the end and leave a response. Pinging is currently not allowed.

    <?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
    // Neither Comments, nor Pings are open ?>
    Both comments and pings are currently closed.

    <?php } edit_post_link('Edit this entry','','.'); ?>

    </p>

    </div>
    </div>

    <?php comments_template(); ?>

    <?php endwhile; else: ?>

    <p>Sorry, no posts matched your criteria.</p>

    <?php endif; ?>

    </div>

    <?php get_footer(); ?>
  • Strangeness, for some reason the footer and sidebar are getting sucked up into the content and content padding DIVs on the main index.php page. However on a single.php page with out any comments, I only see the sidebar getting sucked up into the content DIV. And on single.php page with 1 or more comments, the footer and sidebar appear perfectly. This is nuts!!! If anyone else wants to give a shot, be my guest!

    http://criticall.co.cc/
  • On index.php you have #sidebar inside the post div inside #contentpadding. And on single.php it's inside #content.

    As always, validate.
    index.php http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fcriticall.co.cc%2F

    single.php http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fcriticall.co.cc%2Fthis-post-will-have-no-comments-for-the-first-few-minutes-of-its-life%2F
  • "apostrophe" said:
    On index.php you have #sidebar inside the post div inside #contentpadding. And on single.php it's inside #content.

    As always, validate.
    index.php http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fcriticall.co.cc%2F

    single.php http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fcriticall.co.cc%2Fthis-post-will-have-no-comments-for-the-first-few-minutes-of-its-life%2F


    Hey I just changed servers. All the code is the same but I made new posts.

    I see what you mean about the #sidebar being inside the post div inside the #contentpadding but how did it get there? I checked my index.php and single.php pages and the #footer and #sidebar come after all the other DIVS (content, contentpadding, post) have been sealed with the </div> tags.

    Also I do not quite understand the error messages I am getting back from the Validator like this one:

    # Info Line 55: start tag was here

    ><div id="content">

    What is wrong with this? and What does "start tag was here" mean? I guess I have to research all this.
  • It means you have an unclosed tag or div somewhere, which may or may not sort out your layout problems when it is fixed.
  • Hey thanks apostrophe. I added 2 </div> tags and the index.php page is 100% valid now :)

    I also added 1 </div> at the end of single.php and now there is only one error which is :


    Error Line 142, Column 103: Attribute "aria-required" is not a valid attribute

    …ize="22" tabindex="1" aria-required='true' />


    ...but that is Wordpress code that I did not touch. Thats' a language I dont get.

    Anyways, so the single.php layout looks as it should IF there are no comments. If there are any comments, the only problem is that the sidebar starts towards the bottom of the page. The footer is in place though. Remember, before adding that extra </div> at the end of the single.php document (but before the php calling code for the sidebar and footer) the single.php pages with posts were showing up fine. So now this seems to be a major conundrum. Any more suggestions?
  • Just ran a single page with comments through the validator http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fcriticall.co.cc%2F%3Fp%3D3 and you still have mismatched tags in there. Check comments.php, I'm pretty sure that's where the problem will be.

    As for "aria-required='true'" - don't worry about it http://comox.textdrive.com/pipermail/wp-testers/2008-November/010081.html.
  • "apostrophe" said:
    Just ran a single page with comments through the validator http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fcriticall.co.cc%2F%3Fp%3D3 and you still have mismatched tags in there. Check comments.php, I'm pretty sure that's where the problem will be.

    As for "aria-required='true'" - don't worry about it http://comox.textdrive.com/pipermail/wp-testers/2008-November/010081.html.


    Hey apsotrophe, Thanks for letting me about the "Aria-required=true" situation. So I found out the culprit tag was actually in the footer.php. To be more specific, it was the </div> that followed <div id="push"></div>. When I got rid of that and ran it through the Validator it said my document was ok but here is the catch....The sidebar still starts near the bottom of the page. So no visual change happening here.

    On top of that, the footer for my index.php and my NON-commented single.php page stretch 1000px wide when it is supposed to go 100% of the browser width. When I run the index.php and my NON-commented single.php page through the Validator it says that I have 4 errors. 3 of them are related to problems with the </body> and </html> tags. Then there is the one that is related to the <div id="pagewrap">. Here are the URLS:

    index.php http://validator.w3.org/check?uri=http%3A%2F%2Fcriticall.co.cc%2F&charset=(detect+automatically)&doctype=Inline&group=0

    NON-commented single.php http://validator.w3.org/check?uri=http%3A%2F%2Fcriticall.co.cc%2F%3Fp%3D4&charset=(detect+automatically)&doctype=Inline&group=0&verbose=1&user-agent=W3C_Validator%2F1.654

    I am at the point where I am seriously thinking about starting over with the coding because I feel I have reached an sever impass where by solving one problem I create another. It's highly frustrating. Once again though, any help would be appreciated.
  • 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:
     
    </form>

    </div>

    </div>

    </div>

    </div>


    </div>

    </div><!--REMOVE THIS-->

    <div id=\"sidebar\">
    <div id=\"sidebarpadding\">

    <h2>archives</h2>


    </div>

    </div>
    <div id=\"push\"></div>

    </div><!--PUT THIS BACK-->

    <div id=\"footer\">


    That closes the page wrapper, and then just add this to the stylesheet:
    #footer {
    width: 100%;
    }
  • 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
  • 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.
  • 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.
  • "apostrophe" said:
    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:

    <?php if ( have_comments() ) : ?>
    <h3><?php comments_number('no comments', '1 comment', '% comments' );?> </h3>


    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:

    <?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() ) { ?>
    <p class=\"nocomments\">enter the password to view comments</p>
    <?php
    return;
    }
    ?>

    <div class=\"comments\">

    <?php if ( have_comments() ) : ?>
    <h3><?php comments_number('no comments', '1 comment', '% comments' );?> </h3>

    </div>

    <div class=\"navigation\">
    <div><?php previous_comments_link() ?></div>
    <div><?php next_comments_link() ?></div>
    </div>

    <ol class=\"commentlist\">
    <?php wp_list_comments(); ?>
    </ol>

    <div class=\"navigation\">
    <div><?php previous_comments_link() ?></div>
    <div><?php next_comments_link() ?></div>
    </div>
    <?php else : // this is displayed if there are no comments so far ?>





    <?php if ('open' == $post->comment_status) : ?>
    <!-- If comments are open, but there are no comments. -->



    <?php else : // comments are closed ?>
    <!-- If comments are closed. -->
    <p class=\"nocomments\">Comments are closed.</p>

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


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

    <div id=\"respond\">

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

    <div class=\"cancel-comment-reply\">
    <small><?php cancel_comment_reply_link(); ?></small>
    </div>

    <?php if ( get_option('comment_registration') && !$user_ID ) : ?>
    <p>You must be <a href=\"<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>\">logged in</a> to post a comment.</p>
    <?php else : ?>

    <form action=\"<?php echo get_option('siteurl'); ?>/wp-comments-post.php\" method=\"post\" id=\"commentform\">

    <?php if ( $user_ID ) : ?>

    <p>Logged in as <a href=\"<?php echo get_option('siteurl'); ?>/wp-admin/profile.php\"><?php echo $user_identity; ?></a>. <a href=\"<?php echo wp_logout_url(get_permalink()); ?>\" title=\"Log out of this account\">Log out &raquo;</a></p>

    <?php else : ?>

    <p><input type=\"text\" name=\"author\" id=\"author\" value=\"<?php echo $comment_author; ?>\" size=\"22\" tabindex=\"1\" <?php if ($req) echo \"aria-required='true'\"; ?> />
    <label for=\"author\">name <?php if ($req) echo \"(required)\"; ?></label></p>

    <p><input type=\"text\" name=\"email\" id=\"email\" value=\"<?php echo $comment_author_email; ?>\" size=\"22\" tabindex=\"2\" <?php if ($req) echo \"aria-required='true'\"; ?> />
    <label for=\"email\">email (will not be published) <?php if ($req) echo \"(required)\"; ?></label></p>

    <p><input type=\"text\" name=\"url\" id=\"url\" value=\"<?php echo $comment_author_url; ?>\" size=\"22\" tabindex=\"3\" />
    <label for=\"url\">website</label></p>

    <?php endif; ?>

    <!--<p><small><strong>XHTML:</strong> You can use these tags: <code><?php echo allowed_tags(); ?></code></small></p>-->

    <p><textarea name=\"comment\" id=\"comment\" cols=\"100%\" rows=\"10\" tabindex=\"4\"></textarea></p>

    <p><input name=\"submit\" type=\"submit\" id=\"submit\" tabindex=\"5\" value=\"Submit Comment\" />
    <?php comment_id_fields(); ?>
    </p>
    <?php do_action('comment_form', $post->ID); ?>

    </form>

    <?php endif; // If registration required and not logged in ?>
    </div>

    <?php endif; // if you delete this the sky will fall on your head ?>


    and single.php:

    <?php get_header(); ?>

    <div id=\"content\">

    <div id=\"contentpadding\">

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    <div class=\"navigation\">
    <div><?php previous_post_link('previous %link') ?></div>
    <div><?php next_post_link('next %link') ?></div>
    </div>

    <div <?php post_class() ?> id=\"post-<?php the_ID(); ?>\">
    <h2><?php the_title(); ?></h2>

    <div class=\"date\">
    <?php the_time('l, F jS, Y') ?> <!-- by <?php the_author() ?> -->
    </div>

    <div class=\"metadata\">
    Posted in <?php the_category(' / ') ?>
    </div>

    <div class=\"clear\"></div>

    <div class=\"entry\">
    <?php the_content('<p class=\"serif\">Read the rest of this entry &raquo;</p>'); ?>

    <div class=\"tags\">
    <p class=\"postmetadata\"><?php the_tags('Tags:&nbsp;&nbsp; ', ' / ', '<br />'); ?></p>
    </div>

    <div class=\"balloon\">

    <p class=\"balloontext\">

    <a href=\"#respond\">post comment</a>

    </p>

    </div>


    <div class=\"clear\"></div>

    <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>

    <p class=\"postmetadata alt\">

    <?php post_comments_feed_link('comments RSS'); ?>

    <?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
    // Both Comments and Pings are open ?><a href=\"<?php trackback_url(); ?>\" rel=\"trackback\">trackback</a>

    <?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
    // Only Pings are Open ?>
    Responses are currently closed, but you can <a href=\"<?php trackback_url(); ?> \" rel=\"trackback\">trackback</a> from your own site.

    <?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
    // Comments are open, Pings are not ?>
    You can skip to the end and leave a response. Pinging is currently not allowed.

    <?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
    // Neither Comments, nor Pings are open ?>
    Both comments and pings are currently closed.

    <?php } edit_post_link('Edit this entry','','.'); ?>

    </p>

    <?php comments_template(); ?>

    </div>

    </div>

    </div>

    <?php endwhile; else: ?>

    <p>Sorry, no posts matched your criteria.</p>

    <?php endif; ?>

    </div>



    <?php get_sidebar(); ?>

    <?php get_footer(); ?>
  • Well, the most obvious thing I see there is:
    <div class=\"comments\">

    <?php if ( have_comments() ) : ?>
    <h3><?php comments_number('no comments', '1 comment', '% comments' );?> </h3>

    </div>

    Should be :


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

    <div class=\"comments\">
    <h3><?php comments_number('no comments', '1 comment', '% comments' );?> </h3>
    </div>
  • 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
  • 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?
  • "apostrophe" said:

    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?
  • 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.
  • "apostrophe" said:
    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
  • Ok, this is untested but let's move that 'if' statement:

    <div class=\"comments\">
    <h3><?php comments_number('no comments', '1 comment', '% comments' );?> </h3>
    </div>

    <div class=\"navigation\">
    <div><?php previous_comments_link() ?></div>
    <div><?php next_comments_link() ?></div>
    </div>

    <?php if ( have_comments() ) : ?>
    <ol class=\"commentlist\">
    <?php wp_list_comments(); ?>
    </ol>

    NB I only just noticed that you have <div class="navigation"> twice, once before the comments list and once after, is that right?
  • Yes! "No Coments" now shows! Excellent work apostrophe :)