Author Topic: Coding (HELP)  (Read 1617 times)

0 Members and 1 Guest are viewing this topic.

Offline icysk8r

  • DTF Resident Magician
  • DTF.org Alumni
  • ****
  • Posts: 1393
  • Gender: Male
  • www.bedeceived.com
Coding (HELP)
« on: April 09, 2011, 12:48:54 AM »
Hey guys.  I realize we get a lot of threads like this, but I"m really kinda stuck here.  I'm using a wordpress theme, and I've run into a problem.  For some reason, the comments title does not match the article title.  Here's an example:

https://www.collinstovermagic.com/250-fans/

See how the title is 200 fans!  But the comments section says Comments for Discount by Collin Stover, my previous article. 
How can I fix this?  Is this a coding problem, or a wordpress problem?  Here is the block of code that would be the problem, I just don't know how to fix it.

<!-- begin content -->
   <div id="content-top"></div>
   <div id="content" class="clearfix">
<!-- begin contentLeft -->
   <div id="contentLeft" class="clearfix">
      <?php
      if (have_posts()) :
      while (have_posts()) : the_post(); ?>
         <!-- blog item --><div class="postBox"><div class="top-target"></div><div class="bottom-target"></div><div class="post-date"><?php the_time('j')?><span><?php the_time('m/Y');?></span></div>
               <h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>
               <div class="clear"></div>
               <div class="metadata insidemeta">By: <?php the_author(); ?> on <?php the_time('M. j, Y');?> with <span><?php comments_number('No Comment', '1 Comment', '% Comments');?></span></div>
            <?php the_content(); ?>


The part in red shows the exact part that I think is the problem.  I just don't know how to fix it.   Any help would be appreciated!
www.bedeceived.com

ZOMG WHAT'S AT BEDECEIVED.COM?

I DUNNO!  CLICK THE DARNED LINK TO FIND OUT!

Offline bremac

  • Posts: 98
Re: Coding (HELP)
« Reply #1 on: April 09, 2011, 09:17:55 AM »
Hey guys.  I realize we get a lot of threads like this, but I"m really kinda stuck here.  I'm using a wordpress theme, and I've run into a problem.  For some reason, the comments title does not match the article title.  Here's an example:

https://www.collinstovermagic.com/250-fans/

See how the title is 200 fans!  But the comments section says Comments for Discount by Collin Stover, my previous article.  
How can I fix this?  Is this a coding problem, or a wordpress problem?  Here is the block of code that would be the problem, I just don't know how to fix it.

Code: [Select]
<!-- begin content -->
<div id="content-top"></div>
<div id="content" class="clearfix">
<!-- begin contentLeft -->
<div id="contentLeft" class="clearfix">
<?php 
if (have_posts()) : 
while (have_posts()) : the_post(); ?>

<!-- blog item --><div class="postBox"><div class="top-target"></div><div class="bottom-target"></div><div class="post-date"><?php the_time('j')?><span><?php the_time('m/Y');?></span></div>
<h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>
<div class="clear"></div>
<div class="metadata insidemeta">By: <?php the_author(); ?> on <?php the_time('M. j, Y');?> with <span><?php comments_number('No Comment''1 Comment''% Comments');?></span></div>
<?php the_content(); ?>

The part in red shows the exact part that I think is the problem.  I just don't know how to fix it.   Any help would be appreciated!

If you're looking to fix the issue with the post title not matching the comment title, the part in red has nothing to do with it: that element contains "By: stovermagic on Apr. 9, 2011 with No Comment". You want whatever is generating the h2 element with the id "comments".

Offline icysk8r

  • DTF Resident Magician
  • DTF.org Alumni
  • ****
  • Posts: 1393
  • Gender: Male
  • www.bedeceived.com
Re: Coding (HELP)
« Reply #2 on: April 09, 2011, 12:35:03 PM »
This is the full comments text page.  What should I change?  I really appreciate your help.


<?php

// 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">This post is password protected. Enter the password to view comments.</p>
   <?php
      return;
   }
?>

<!-- You can start editing here. -->

<?php if ( have_comments() ) : ?>
   <h2 id="comments"><?php comments_number('No Comments', 'One Comment', '% Comments' );?> to &#8220;<?php the_title(); ?>&#8221;</h2>

   <ul class="commentlist">
   <?php wp_list_comments('callback=mytheme_comment'); ?>
   </ul>

   <div class="navigation">
      <div class="alignleft"><?php previous_comments_link() ?></div>
      <div class="alignright"><?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">

<h2><?php comment_form_title( 'Post comment', 'Post comment on %s' ); ?></h2>

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

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

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

<?php endif; ?>

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

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

<p><input name="submit" type="submit" id="submit" tabindex="5" value="Send &raquo;" />
<?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 ?>
www.bedeceived.com

ZOMG WHAT'S AT BEDECEIVED.COM?

I DUNNO!  CLICK THE DARNED LINK TO FIND OUT!

Offline bremac

  • Posts: 98
Re: Coding (HELP)
« Reply #3 on: April 09, 2011, 01:48:41 PM »
Code: [Select]
// From the code generating the blog post.
<h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>

Code: [Select]
// From the code generating the comments section.
<h2 id="comments"><?php comments_number('No Comments''One Comment''% Comments' );?> to &#8220;<?php the_title(); ?>&#8221;</h2>

I honestly have no idea why the results of those two calls to the_title() would be different, unless something really weird is going on in a theme callback or something. I don't normally do WordPress work, so I can't think of what could be causing it off the top of my head, and unfortunately I don't have time to dig any deeper this week.

Offline icysk8r

  • DTF Resident Magician
  • DTF.org Alumni
  • ****
  • Posts: 1393
  • Gender: Male
  • www.bedeceived.com
Re: Coding (HELP)
« Reply #4 on: April 09, 2011, 03:32:04 PM »
Code: [Select]
// From the code generating the blog post.
<h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>

Code: [Select]
// From the code generating the comments section.
<h2 id="comments"><?php comments_number('No Comments''One Comment''% Comments' );?> to &#8220;<?php the_title(); ?>&#8221;</h2>

I honestly have no idea why the results of those two calls to the_title() would be different, unless something really weird is going on in a theme callback or something. I don't normally do WordPress work, so I can't think of what could be causing it off the top of my head, and unfortunately I don't have time to dig any deeper this week.
That's okay,t hank you for your time and help. I'm probably just going to disable comments anyways.  If they want to comment, they can do it on facebook
www.bedeceived.com

ZOMG WHAT'S AT BEDECEIVED.COM?

I DUNNO!  CLICK THE DARNED LINK TO FIND OUT!