Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

main page works, but comments page is messed up WordPress

  • SOLVED

main page:
http://adriennetran.com/123mainst/wordpress/

but click one of the comments and it looks all funny.
i am not too familiar with wordpress.
+ i don't really understand the mechanisms of comments.php and single.php (single post)

i have spent the last 4 hours trying to fix this but to no avail.

if someone could log in and fix up the code for me i would be very grateful and give you money for my gratitude via paypal.

INDEX 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" xml:lang="en" lang="en">

<head>

<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>MainSt123</title>

<?php get_header();?>

<style type="text/css">

body
{background-repeat:repeat-x;
background-color: #000000;
font-family: arial;
font-size: 12px;
color: #656565;
overflow-x: hidden;
overflow-y: scroll;}

a
{color: #03437f;
font-family: arial;
font-size: 12px;
text-decoration: none;}

a.nav
{color: white;
font-family: arial;
font-size: 12px;
text-decoration: none;}

a:hover
{background-color: #246db1;
font-family: arial;
font-size: 12px;
text-decoration: none;}

.box
{background-color: white;
width: 256px;
height: 301px;
padding: 10px;}

.head
{font-family: georgia;
font-size: 21px;
color: white;
margin-bottom: 5px;}

.headnav
{font-family: georgia;
font-size: 18px;
color: white;
background-color: #aeaeae;
padding: 3px;
width: 305px;
margin-bottom: 5px;}

.title
{font-family: arial;
font-size: 14px;
color: black;
font-weight: bold;}

</style>

<center>

<img src="http://www.adriennetran.com/123mainst/images/bannercloud.jpg">

<div style="margin-top: 50px; margin-left: -710px;">
<font style="font-family: arial; font-weight: bold; font-size: 50px; letter-spacing: -2px;">
<font color="white" style="font-size: 40px;">123</font><font color="#6f99d0">main</font><font color="white">st</font>
</font><br /><br />
</div>

<div style="margin-top: 0px; margin-left: -790px;">
&nbsp; <font style="font-family: arial; font-size: 13px; color: #727273; margin-top: -5px;">slogan slogan slogan</font>
</div>

<div style="margin-top: 15px; margin-left: -5px;">
<a href=""><img src="http://www.adriennetran.com/123mainst/images/nav_home.jpg" border=0></a>
<a href=""><img src="http://www.adriennetran.com/123mainst/images/nav_calculator.jpg" border=0 style="margin-left: -3px;"></a>
<a href=""><img src="http://www.adriennetran.com/123mainst/images/nav_housevalues.jpg" border=0 style="margin-left: -3px;"></a>
<a href=""><img src="http://www.adriennetran.com/123mainst/images/nav_featuredlistings.jpg" border=0 style="margin-left: -3px;"></a>
<a href=""><img src="http://www.adriennetran.com/123mainst/images/nav_aboutme.jpg" border=0 style="margin-left: -3px;"></a>
<a href=""><img src="http://www.adriennetran.com/123mainst/images/nav_propertywatch.jpg" border=0 style="margin-left: -3px;"></a>
<a href=""><img src="http://www.adriennetran.com/123mainst/images/nav_blog.jpg" border=0 style="margin-left: -3px;"></a>
</div>

<div style="margin-top: -10px; margin-left: -350px; background-color: #e8e8e8; width: 575px;">
<br />
<center><img src="http://www.adriennetran.com/123mainst/images/box_companyprofile.jpg"></center>
</div>

<div style="margin-top: -110px; margin-left: -330px; text-align: left; width: 550px;">
<div class="head">company profile</div>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla blandit ligula a est sagittis hendrerit. Aliquam mauris sem, ultrices consectetur facilisis ut, accumsan in urna. Phasellus ultricies, turpis porttitor consectetur ultricies, diam justo cursus sem, eget feugiat tellus sem in sem. Nam non mauris ligula. In suscipit ultrices justo sed pretium. <a href="">(read more)</a>
</div>

<div style="margin-top: -130px; margin-left: 570px; background-color: #d8d8d8; width: 317px; padding: 14px; text-align: left;">
<br />
<div class="headnav">quick links</div>
<table border="0">

<tr>
<td><img src="http://www.adriennetran.com/123mainst/images/icon_neighborhoodinformation.png"></td><td> &nbsp; Neighborhood Information</td>
</tr>

<tr>
<td><img src="http://www.adriennetran.com/123mainst/images/icon_pointsofinterest.png"></td>
<td> &nbsp; Points of Interest and Reviews</td>
</tr>

<tr>
<td><img src="http://www.adriennetran.com/123mainst/images/icon_comparables.png"></td>
<td> &nbsp; Comparables and Price Trends</td>
</tr>

<tr>
<td><img src="http://www.adriennetran.com/123mainst/images/icon_viewmap.png"></td>
<td> &nbsp; View Map</td>
</tr>

<tr>
<td><img src="http://www.adriennetran.com/123mainst/images/icon_birdseyeview.png"></td>
<td> &nbsp; Bird's Eye View</td>
</tr>

<tr>
<td><img src="http://www.adriennetran.com/123mainst/images/icon_areaschools.png"></td>
<td> &nbsp; Area Schools</td>
</tr>

<tr>
<td><img src="http://www.adriennetran.com/123mainst/images/icon_emailtofriend.png"></td>
<td> &nbsp; Email to Friend</td>
</tr>

<tr>
<td><img src="http://www.adriennetran.com/123mainst/images/icon_requestmoreinformation.png"></td>
<td> &nbsp; Request More Information</td>
</tr>

<tr>
<td><img src="http://www.adriennetran.com/123mainst/images/icon_scheduleashowing.png"></td>
<td> &nbsp; Schedule a Showing</td>
</tr>

<tr>
<td><img src="http://www.adriennetran.com/123mainst/images/icon_calculatepayment.png"></td>
<td> &nbsp; Calculate Payment</td>
</tr>

</table>

<p>

<div class="headnav">featured listings</div>
<div class="title">$700,000 Santa Clara, CA - (4 br, 3 bath)</div>

</div>

<div style="margin-top: -230px; margin-left: -350px; background-color: #e8e8e8; width: 565px; padding: 5px; padding-bottom: 20px; text-align: left;">
<div id="main">
<div id="content">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<div class="meta">
<p>
<?php the_time('M') ?>
<?php the_time('d') ?>
<?php the_time('Y') ?>

<?php edit_post_link(); ?></p>
</div>
<div class="entry">
<?php the_content(__('Continue Reading »')); ?>
<?php wp_link_pages(); ?>
</div>

<p class="comments">
<?php comments_popup_link(__('No comments'), __('1 comment'), __('% comments')); ?>

</p>
</div>
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
<p align="center"><?php posts_nav_link(' - ','« Newer','Older »') ?></p>
</div>

</div>

</center>
</html></head>


COMMENTS

<!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" xml:lang="en" lang="en">

<head>

<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>MainSt123</title>

<?php get_header();?>

<style type="text/css">

body
{background-repeat:repeat-x;
background-color: #000000;
font-family: arial;
font-size: 12px;
color: #656565;
overflow-x: hidden;
overflow-y: scroll;}

a
{color: #03437f;
font-family: arial;
font-size: 12px;
text-decoration: none;}

a.nav
{color: white;
font-family: arial;
font-size: 12px;
text-decoration: none;}

a:hover
{background-color: #246db1;
font-family: arial;
font-size: 12px;
text-decoration: none;}

.box
{background-color: white;
width: 256px;
height: 301px;
padding: 10px;}

.head
{font-family: georgia;
font-size: 21px;
color: white;
margin-bottom: 5px;}

.headnav
{font-family: georgia;
font-size: 18px;
color: white;
background-color: #aeaeae;
padding: 3px;
width: 305px;
margin-bottom: 5px;}

.title
{font-family: arial;
font-size: 14px;
color: black;
font-weight: bold;}

</style>

<center>

<img src="http://www.adriennetran.com/123mainst/images/bannercloud.jpg">

<div style="margin-top: 50px; margin-left: -710px;">
<font style="font-family: arial; font-weight: bold; font-size: 50px; letter-spacing: -2px;">
<font color="white" style="font-size: 40px;">123</font><font color="#6f99d0">main</font><font color="white">st</font>
</font><br /><br />
</div>

<div style="margin-top: 0px; margin-left: -790px;">
&nbsp; <font style="font-family: arial; font-size: 13px; color: #727273; margin-top: -5px;">slogan slogan slogan</font>
</div>

<div style="margin-top: 15px; margin-left: -5px;">
<a href=""><img src="http://www.adriennetran.com/123mainst/images/nav_home.jpg" border=0></a>
<a href=""><img src="http://www.adriennetran.com/123mainst/images/nav_calculator.jpg" border=0 style="margin-left: -3px;"></a>
<a href=""><img src="http://www.adriennetran.com/123mainst/images/nav_housevalues.jpg" border=0 style="margin-left: -3px;"></a>
<a href=""><img src="http://www.adriennetran.com/123mainst/images/nav_featuredlistings.jpg" border=0 style="margin-left: -3px;"></a>
<a href=""><img src="http://www.adriennetran.com/123mainst/images/nav_aboutme.jpg" border=0 style="margin-left: -3px;"></a>
<a href=""><img src="http://www.adriennetran.com/123mainst/images/nav_propertywatch.jpg" border=0 style="margin-left: -3px;"></a>
<a href=""><img src="http://www.adriennetran.com/123mainst/images/nav_blog.jpg" border=0 style="margin-left: -3px;"></a>
</div>

<div style="margin-top: -10px; margin-left: -350px; background-color: #e8e8e8; width: 575px;">
<br />
<center><img src="http://www.adriennetran.com/123mainst/images/box_companyprofile.jpg"></center>
</div>

<div style="margin-top: -110px; margin-left: -330px; text-align: left; width: 550px;">
<div class="head">company profile</div>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla blandit ligula a est sagittis hendrerit. Aliquam mauris sem, ultrices consectetur facilisis ut, accumsan in urna. Phasellus ultricies, turpis porttitor consectetur ultricies, diam justo cursus sem, eget feugiat tellus sem in sem. Nam non mauris ligula. In suscipit ultrices justo sed pretium. <a href="">(read more)</a>
</div>

<div style="margin-top: -130px; margin-left: 570px; background-color: #d8d8d8; width: 317px; padding: 14px; text-align: left;">
<br />
<div class="headnav">quick links</div>
<table border="0">

<tr>
<td><img src="http://www.adriennetran.com/123mainst/images/icon_neighborhoodinformation.png"></td><td> &nbsp; Neighborhood Information</td>
</tr>

<tr>
<td><img src="http://www.adriennetran.com/123mainst/images/icon_pointsofinterest.png"></td>
<td> &nbsp; Points of Interest and Reviews</td>
</tr>

<tr>
<td><img src="http://www.adriennetran.com/123mainst/images/icon_comparables.png"></td>
<td> &nbsp; Comparables and Price Trends</td>
</tr>

<tr>
<td><img src="http://www.adriennetran.com/123mainst/images/icon_viewmap.png"></td>
<td> &nbsp; View Map</td>
</tr>

<tr>
<td><img src="http://www.adriennetran.com/123mainst/images/icon_birdseyeview.png"></td>
<td> &nbsp; Bird's Eye View</td>
</tr>

<tr>
<td><img src="http://www.adriennetran.com/123mainst/images/icon_areaschools.png"></td>
<td> &nbsp; Area Schools</td>
</tr>

<tr>
<td><img src="http://www.adriennetran.com/123mainst/images/icon_emailtofriend.png"></td>
<td> &nbsp; Email to Friend</td>
</tr>

<tr>
<td><img src="http://www.adriennetran.com/123mainst/images/icon_requestmoreinformation.png"></td>
<td> &nbsp; Request More Information</td>
</tr>

<tr>
<td><img src="http://www.adriennetran.com/123mainst/images/icon_scheduleashowing.png"></td>
<td> &nbsp; Schedule a Showing</td>
</tr>

<tr>
<td><img src="http://www.adriennetran.com/123mainst/images/icon_calculatepayment.png"></td>
<td> &nbsp; Calculate Payment</td>
</tr>

</table>

<p>

<div class="headnav">featured listings</div>
<div class="title">$700,000 Santa Clara, CA - (4 br, 3 bath)</div>

</div>

<div style="margin-top: -230px; margin-left: -350px; background-color: #e8e8e8; width: 565px; padding: 5px; padding-bottom: 20px; text-align: left;">

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

if ( post_password_required() ) : ?>
<p><?php _e('Enter your password to view comments.'); ?></p>
<?php return; endif; ?>

<h2 id="comments"><?php comments_number(__('No Comments'), __('1 Comment'), __('% Comments')); ?>
<?php if ( comments_open() ) : ?>
<a href="#postcomment" title="<?php _e("Leave a comment"); ?>">&raquo;</a>
<?php endif; ?>
</h2>

<?php if ( have_comments() ) : ?>
<ol id="commentlist">

<?php foreach ($comments as $comment) : ?>
<li <?php comment_class(); ?> id="comment-<?php comment_ID() ?>">
<?php echo get_avatar( $comment, 32 ); ?>
<?php comment_text() ?>
<p><cite><?php comment_type(_x('Comment', 'noun'), __('Trackback'), __('Pingback')); ?> <?php _e('by'); ?> <?php comment_author_link() ?> — <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite> <?php edit_comment_link(__("Edit This"), ' |'); ?></p>
</li>

<?php endforeach; ?>

</ol>

<?php else : // If there are no comments yet ?>
<p><?php _e('No comments yet.'); ?></p>
<?php endif; ?>

<p><?php post_comments_feed_link(__('<abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.')); ?>
<?php if ( pings_open() ) : ?>
<a href="<?php trackback_url() ?>" rel="trackback"><?php _e('TrackBack <abbr title="Universal Resource Locator">URL</abbr>'); ?></a>
<?php endif; ?>
</p>

<?php if ( comments_open() ) : ?>
<h2 id="postcomment"><?php _e('Leave a comment'); ?></h2>

<?php if ( get_option('comment_registration') && !is_user_logged_in() ) : ?>
<p><?php printf(__('You must be <a href="%s">logged in</a> to post a comment.'), wp_login_url( get_permalink() ) );?></p>
<?php else : ?>

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

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

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

<?php else : ?>

<p><input type="text" name="author" id="author" value="<?php echo esc_attr($comment_author); ?>" size="22" tabindex="1" />
<label for="author"><small><?php _e('Name'); ?> <?php if ($req) _e('(required)'); ?></small></label></p>

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

<p><input type="text" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" size="22" tabindex="3" />
<label for="url"><small><?php _e('Website'); ?></small></label></p>

<?php endif; ?>

<!--<p><small><strong>XHTML:</strong> <?php printf(__('You can use these tags: %s'), allowed_tags()); ?></small></p>-->

<p><textarea name="comment" id="comment" cols="58" rows="10" tabindex="4"></textarea></p>

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

</form>

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

<?php else : // Comments are closed ?>
<p><?php _e('Sorry, the comment form is closed at this time.'); ?></p>
<?php endif; ?>

</center>
</html>
</body>



SINGLE PHP
<?php
get_header();
?>

<center>

<div id="content" class="widecolumn" role="main"">

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

<div class="navigation">
<div class="alignleft"><?php previous_post_link('&laquo; %link') ?></div>
<div class="alignright"><?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">
<small>
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/wordpress/time-since/ */
/* $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 ( comments_open() && pings_open() ) {
// 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 ( !comments_open() && pings_open() ) {
// 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 ( comments_open() && !pings_open() ) {
// Comments are open, Pings are not ?>
You can skip to the end and leave a response. Pinging is currently not allowed.

<?php } elseif ( !comments_open() && !pings_open() ) {
// Neither Comments, nor Pings are open ?>
Both comments and pings are currently closed.

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

</small>
</p>

</div>
</div>

<?php comments_template(); ?>

<?php endwhile; else: ?>

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

<?php endif; ?>

</center>
</div></div>

<?php get_footer(); ?>




*** IF ANYONE WOULD BE WILLING TO LOG IN AND EDIT IT WILL GIVE EXTRA CASH.
(i have just grown so frustrated with wordpress after trying to fix it for so long and not being able to figure it out)

Answers (3)

2010-01-12

Brandon Dove answers:

I'd be happy to login and check it out for you.

2010-01-12

Brian Richards answers:

Alright, it looks like you have a number of different things going on here that you could/should do differently.

Firstly, I recommend pulling all of that styling from the beginning of each document and putting it into your stylesheet (style.css). Secondly, you can remove all of the common/generic items (doctype, head, navigation, etc) that appear before your content areas and put it into your header.php and call that via <?php get_header(); ?> as you have it in single.php.

Your real issue, however, is that your comments.php file duplicates a lot of stuff unnecessarily. It shouldn't actually include anything except the logic that produces the comments themselves (nothing that would appear in your header, sidebar, footer, or any other page templates). This is because comments.php is called into other pages, it is never displayed by itself.

For a good example of how comments.php should look, I suggest copying the file from the default theme exactly. (If you've altered the default theme then I suggest re-downloading wordpress and pulling it from there, you should leave a completely un-altered version of the default theme in the themes directory should WP need a fallback for any reason).

Once you've taken care of that, I think you'll be all set!

Also, the WordPress codex is a brilliant resource for learning about how themes work, what all of the functions do, and how to properly use different functions. Check it out at http://codex.wordpress.org

Here are some especially helpful sections:
[[LINK href="http://codex.wordpress.org/Template_Tags"]]Template Tags[[/LINK]]
[[LINK href="http://codex.wordpress.org/Template_Hierarchy"]]Template Hierarchy[[/LINK]]
[[LINK href="http://codex.wordpress.org/images/1/18/Template_Hierarchy.png"]]Visual Diagram of Template Hierarchy[[/LINK]]
[[LINK href="http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates"]]Creating custom page templates[[/LINK]]

2010-01-12

Rob Mason answers:

Stick your COCTYPE delaration and head elements into the header.php. Leave the code that says <?php get_header();?> at the top of your single.php as it's doing the donkey work for you. Basically specify once and let Wordpress do the leg work.

Your comments.php does not need to repeat these header elements if you've included the <?php get_header();?> line. The comments.php as simply the section on the page that deals with comments. Everything else is called from a number of places. So if you were to mentally chunk the page up you'd have a header, sidebar, footer and comments section. Each of these is contained in a file by the same name and Wordpress then assembles it all for you.