• My comments won’t display properly!! I am using the WP for Designers screencast from themeforest.net and I have suddenly run into trouble. My comments are all messed up and not displaying properly. I get repeat posts, and when I try to comment, I am taken to a blank page. Any help would be appreciated. This is my comment code:

    <?php
    if(!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME'])){
    	die('Please do not load this page directly.');
    }
    if(post_password_required()){
    ?>
    	<p>This post is password protected.</p>
    <?php return; } ?>
    
    <?php
    //Display comment loop
    if(have_posts()) :
    ?>
    	<h2><?php comments_number('Be the first to comment!', 'One Comment', '% Comments'); ?></h2>
    	<ol id='comments_section'>
    		<?php wp_list_comments(array('avatar_size'=>80, 'reply_text'=>'Reply to this comment.')); ?>
    	</ol>
    	<div><?php paginate_comments_links(); ?></div>
    	<?php
    	else ://If no comments so far
    	?>
    
    	<?php if('open' == $post->comment_status) : ?>
    	<p>Have your say!</p>
    	<?php else :?>
    	<p>Comments currently closed.</p>
    		<?php endif;?>
    	<?php endif; ?>
    <?php if('open' == $post->comment_status) : ?>
    
    <div id='respond'>
    	<h2><?php comment_form_title(); ?></h2>
    
    	<div id='cancel-comment-reply'>
    		<small><?php cancel_comment_reply_link(); ?></small>
    	</div>
    
    	<?php if(get_option('comment_registration') && !$user_ID): ?>
    		<p>You must be logged in to comment.</p>
    	<?php else : ?>
    	<form action="<?php echo get_option('site_url'); ?>/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></p>
    
    	<?php else : ?>
    		<p><input type='text' name='author' id='author' value="<?php echo $comment_author;?>" />
    		<label for='author'>Name</label></p>
    		<p><input type='text' name='email' id='email' value="<?php echo $comment_author_email;?>" />
    		<label for='email'>Mail <?php if($req) echo '(Required field)';?></label>
    		</p>
    		<p>
    		<input type='text' name='url' id='url' value="<?php echo $comment_author_url; ?>" />
    		<label for='url'>Website</label>
    		</p>
    	<?php endif; ?>
    	<div><?php comment_id_fields(); ?>
    	<input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars($_SERVER['REQUEST_URI'])?>" />
    	</div>
    
    	<p><textarea id='comment' name='comment' cols='50' rows='10'></textarea></p>
    
    	<?php if(get_option('comment_moderation') == '1'){ ?>
    		<p>Comment moderation is enabled. No need to resubmit comments.</p>
    	<?php } ?>
    
    	<p><input type='submit' name='submit' id='submit' value='Submit' /></p>
    	<?php do_action('comment_form', $post->ID); ?>
    	</form>
    	<?php endif; ?>
    </div>
    <?php endif; ?>

    This is my header code:

    <html xmlns="https://www.w3.org/1999/xhtml" <?php language_attributes();?>>
    <head>
    	<meta http-equiv="Content-Type" content='<?php bloginfo("html_type");?> charset=<?php bloginfo("charset");?>'/>
    	<title><?php bloginfo('name') ;?><?php wp_title('||'); ?> </title>
    	<link rel='stylesheet' href='<?php bloginfo("stylesheet_url");?>' type='text/css' media='screen' />
    	<?php if(is_singular()){ wp_enqueue_script('comment-reply');} ?>
    	<?php wp_head(); ?>
    </head>
    
    <body>
    	<div id='wrap'>
    
    	<!--Begin Header-->
    		<div id='header'>
    			<h1><a href="<?php echo get_option('home');?>/"><?php bloginfo('name');?></a></h1>
    			<div class='tagline'><?php bloginfo('description'); ?></div>
    			<ul id='nav'><?php wp_list_pages('title_li='); ?></ul>
    
    		</div>
    	<!--End Header-->

    This is my single.php code:

    <?php get_header(); ?>
    <?php get_sidebar(); ?>
    
    <div class='single_post'>
    	<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    
    		<h2><?php the_title(); ?></h2>
    
    		<div class='single_entry'>
    			<em>Article posted on <?php the_time('l, F, jS, Y'); ?> at <?php the_time(); ?></em>
    			<?php the_content(); ?>
    			<?php the_tags(); ?>
    			<?php edit_post_link('Edit this post...', '<p>', '</p>'); ?>
    			<div class='promote'>
    			<h2>Enjoy this article?</h2>
    			<p>Please subscribe to our <a href="<?php bloginfo('rss2_url'); ?>">RSS Feed</a></p>
    			</div>
    			<?php comments_template(); ?>
    		</div>
    
    		<?php endwhile; else: ?>
    		<h3>Sorry but we could not find what you were looking for.</h3>
    		<div><?php get_search_form(); ?></div>
    		<?php endif; ?>
    </div>
    <?php include(TEMPLATEPATH . '/footer.php'); ?>

    Here is a screenshot of what is happening

    Any suggestions?

  • The topic ‘Comments Section help!!’ is closed to new replies.