Web Design Forum: Content keeps looping - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Content keeps looping Rate Topic: -----

#1 User is offline   mantis 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 201
  • Joined: 29-May 11
  • Reputation: 5
  • Gender:Female
  • Location:Oooh la la land
  • Experience:Intermediate
  • Area of Expertise:Designer

Posted 05 February 2012 - 02:53 PM

I'm working locally on a wordpress theme and am modifying a comments.php template file that was created for version 2.7. My content keeps looping and I imagine this is the origin of the problem. I like this particular one because I understand the php which is not my strongsuit. Can anyone tell me what is making the content loop?
<?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 the 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 any comments posted.</p>
	<?php } ?>	
	
	<p><input type='text' name='submit' id='submit' value='Submit' /></p>
	<?php do_action('comment_form', $post->ID); ?>
	</form>
	<?php endif; ?>
</div>
<?php endif; ?>

0

#2 User is online   Renaissance-Design 

  • Available for custom WordPress work
  • View blog
  • Group: Moderators
  • Posts: 3,595
  • Joined: 12-August 10
  • Reputation: 559
  • Gender:Male
  • Location:South Wales
  • Experience:Web Guru
  • Area of Expertise:Designer/Coder

Posted 05 February 2012 - 03:04 PM

Junk it, and start from something up to date. Especially if PHP isn't your strong suit, you should never use old code.
0

#3 User is offline   mantis 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 201
  • Joined: 29-May 11
  • Reputation: 5
  • Gender:Female
  • Location:Oooh la la land
  • Experience:Intermediate
  • Area of Expertise:Designer

Posted 06 February 2012 - 08:22 AM

Thanks for the advice, I've gone to modifying a template rather than trying to piece one together myself. Much easier.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users