WordPress.org

Ready to get started?Download WordPress

Forums

When click on comments link the reader is taken to the top of the page (57 posts)

  1. Lance007
    Member
    Posted 4 years ago #

    Hi,

    I am relatively new to WordPress - I have just written my first post.

    Could you please help me resolve the following issue:

    I am using the "Emerald Stretch" template on wordpress. Every time someone clicks on "Comment" to leave a comment to a post, the person is taken to the top of the page and they have to scroll down to the comment form to leave a comment.

    And a similar problem when they hit the "Submit" button - instead of the person being taken to the bottom of the post where they can see their comment, they are taken to the top of the page and they have to scroll down to see their comment.

    What code can I use in the template files to change this action. Although I am a beginner I am picking up how to change the code as I go.

    Thanks a lot,

    Lance

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    Site url?

  3. Lance007
    Member
    Posted 4 years ago #

    lancesview.com or lancesview.com/blog1

    Thanks

  4. Adam Harley
    Member
    Posted 4 years ago #

    Your anchor (#respond) doesn't actually exist. To go to your comment form, you would need to either change that to #comments or change the ID of your comment form to 'respond'.

  5. Lance007
    Member
    Posted 4 years ago #

    Thanks Kawauso, but I'm confused. Keep in mind I'm must a beginner. I know what you mean by anchor, but I need to know exactly what to write and where.

    Do I actually just type "#respond"?
    Do I place that in the index file? Single post file? comments file?

    What's the correlating code to the anchor that I can search for. I tried searching for "respond" but found nothing.

    thanks again,

    Lance

  6. Adam Harley
    Member
    Posted 4 years ago #

    Sorry about that. Try looking under the comments.php file for "respond" or 'respond' and changing the part inside the quotes to comments and hopefully it should work. Sorry I can't be more specific, but it varies by theme how it's all done.

  7. Lance007
    Member
    Posted 4 years ago #

    Hi Kawauso,

    I'm still not sure what to do. Here is the comments.php file. Maybe you can see something that's off. Thanks:

    <?php
    if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
    die (__('Please do not load this page directly.', 'emerald_stretch'));

    if (!empty($post->post_password)) {
    if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) {
    ?>
    <p><?php _e('This post is password protected. Enter the password to read comments.', 'emerald_stretch'); ?></p>
    <?php
    return;
    }
    }
    $oddcomment = 'alt';
    ?>

    <div id="comments">
    <?php if ($comments) : ?>
    <h1><?php comments_number(__('No Responses','emerald_stretch'), __('One Response','emerald_stretch'), __('% Responses','emerald_stretch')); //_e(' to “','emerald_stretch'); the_title(); _e('”', 'emerald_stretch'); ?></h1>
    <div id="comment-area">

      <?php foreach ($comments as $comment) : ?>
      <li class="<?php echo $oddcomment; ?> <?php if (function_exists('author_highlight')) { ?> <?php author_highlight(); ?><?php } ?>" id="comment-<?php comment_ID() ?>">

      <p class="commenter"><?php echo get_avatar( $comment, 48 ); ?> <?php comment_author_link() ?><span class="comment-info"> - <?php comment_date(__('F j, Y', 'emerald_stretch')) ?></span></p>
      <?php if ($comment->comment_approved == '0') : ?>
      <span class="comment-moderation"><?php _e('••• Your comment is awaiting moderation •••', 'emerald_stretch'); ?></span>
      <?php endif; ?>
      <?php comment_text() ?>

      <?php
      if ('alt' == $oddcomment) $oddcomment = '';
      else $oddcomment = 'alt';
      ?>

      <?php endforeach; ?>

    </div>

    <?php if ('closed' == $post->comment_status) : ?>
    <!-- <h3><?php _e('Comments are closed for this entry.', 'emerald_stretch'); ?></h3> -->
    </div>
    <?php endif; ?>

    <?php else : ?>
    <?php if ('open' == $post->comment_status) : ?>
    <?php else : ?>
    <!-- <h3><?php _e('Comments are closed for this entry.', 'emerald_stretch'); ?></h3> -->
    </div>
    <?php endif; ?>
    <?php endif; ?>

    <?php if ('open' == $post->comment_status) : ?>
    <div id="comment-form">
    <h1><?php _e('Post a Comment', 'emerald_stretch'); ?></h1>
    <?php if ( get_option('comment_registration') && !$user_ID ) : ?>
    <p><?php _e('You must be', 'emerald_stretch'); ?> /wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>"><?php _e('logged in', 'emerald_stretch'); ?><?php _e(' to post a comment', 'emerald_stretch'); ?>.</p>
    </div>
    <?php else : ?>
    <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
    <?php if ( $user_ID ) : ?>
    <p><?php _e('Logged in as', 'emerald_stretch'); ?> /wp-admin/profile.php"><?php echo $user_identity; ?>. <?php wp_loginout(); ?>.<!-- /wp-login.php?action=logout" title="<?php _e('Log out of this account', 'emerald_stretch'); ?>"><?php _e('Log out »', 'emerald_stretch'); ?> --></p>
    <?php else : ?>
    <p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="30" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />
    <label for="author"><?php _e('Name', 'emerald_stretch'); ?><?php if ($req) _e(', required', 'emerald_stretch'); ?></label></p>
    <p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="30" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />
    <label for="email"><?php _e('Email (will not be published)', 'emerald_stretch'); ?><?php if ($req) _e(', required', 'emerald_stretch'); ?></label></p>
    <p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="30" tabindex="3" />
    <label for="url"><?php _e('Your Website (optional)', 'emerald_stretch'); ?></label></p>
    <?php endif; ?>
    <p><textarea name="comment" id="comment" cols="60" rows="10" tabindex="4"></textarea></p>
    <?php do_action('comment_form', $post->ID); ?>
    <p>
    <input name="submit" class="button" type="submit" id="submit" tabindex="5" value="<?php _e('Submit', 'emerald_stretch'); ?>" />
    <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
    </p>
    </form>
    </div>
    <?php endif; ?>
    </div>
    <?php endif; ?>

  8. Adam Harley
    Member
    Posted 4 years ago #

    Change <div id="comments"> to <div id="respond">, about 15 lines down. I keep getting my names the wrong way round today sorry :P

  9. Lance007
    Member
    Posted 4 years ago #

    Hi,

    I made the change and it didn't seem to do anything. Any other suggestions?

    Thanks

  10. Lance007
    Member
    Posted 4 years ago #

    Does anyone else have a suggestion?

    Thanks

  11. Adam Harley
    Member
    Posted 4 years ago #

    @Lance007: It works here. It'll only scroll as far down as the bottom of the page though, so it might not look like it's moved if the page doesn't fill the screen. If that's not the case, try using Ctrl+F5 to get a fresh copy of the page.

    Try this: http://lancesview.com/blog1/law-firm-experience/send-kid-upin-ferrari/#respond

  12. Lance007
    Member
    Posted 4 years ago #

    Hi Kawauso,

    It does work now - that's great. I apologize.
    Thanks a lot for your help - I appreciate it.
    I don't understand how a change from comments to respond would do that, but it does.

    Lance

  13. Adam Harley
    Member
    Posted 4 years ago #

    The part after # in a link essentially means, "Look for something with the id or name set to this and scroll to it", so it was just looking for the wrong name before :)

  14. Lance007
    Member
    Posted 4 years ago #

    I guess that's what I don't understand. I didn't see any other "respond" in the file that it could scroll to.

    While I have you here - perhaps you would answer another question for me. How do I set my blog so that posed comments are automatically shown on my site below the post, rather than people having to click on the "comments" link in order to see the posted comments? (at least to see a number of them before clicking on a link to see more)
    And is there a way to make the "comments" link bigger so people can actually notice it if they want to leave a comment?

    Thanks

  15. Adam Harley
    Member
    Posted 4 years ago #

    Nice blog btw :)

    Put <?php $withcomments = true; comments_template(); ?> under a line with the_content( in index.php.

    Then in comments.php before <?php if ('closed' == $post->comment_status) : ?>, put <?php if ( !is_home() ) : ?> and after the final line, put

    <?php else : ?>
    </div>
    <?php endif; ?>

    and to take out the responses header, put <?php if ( !is_home() ) : ?> and <?php endif; ?> around the line beginning <h1>

    If you want to limit the number of comments shown, in comments.php before:
    <?php endforeach; ?>
    put:

    <?php
    if ( is_home() ) {
      static $comment_output_count = 0;
      $comment_output_count++;
      if ( $comment_output_count == 5 )
        break;
    }
    ?>

    just change 5 to whatever you want to cap it at.

    To change the size of the comments link (or at least, the entire line) look in your stylesheet for #postmeta { and change font-size: 80% to something higher (it's done relative to the size of the normal text).

  16. Lance007
    Member
    Posted 4 years ago #

    Thanks a lot Kawauso.
    When you get sick of my questions just tell me.

    1) I didn't understand what you meant about if I want to "take out the responses header" - what is the responses header? (I haven't put that code in yet)

    I can now see the comments automatically. I have a couple other questions:
    2) Is there a way to leave it so that I can see the comments automatically as I have it, but not see the "comment form" automatically. So that just below or above the comment there's a link saying "post a comment" which brings up the comment form. I find that it's too long and I want the reader to be able to see my next post easily.

    3) When I click on the "COMMENTS" OR "ONE COMMENT" link at the bottom of the post, instead of taking me to the comments section, it takes me to the top of the page. Is there a way for the link to take me to the comments section rather than the top of the page?

    Thanks again for all your help. It makes this a hell of a lot easier.

    Lance

  17. Adam Harley
    Member
    Posted 4 years ago #

    1) The bit that says "2 Responses" or whatever, looks okay with it in actually, so meh.

    2) In comments.php, before <div id="comment-form"> put <?php if ( is_home() ) : ?><a href="javascript:void()" onclick="document.getElementById('comment-form-<?php the_ID(); ?>').style.visibility = 'visible'">Post comment</a><?php endif; ?>. Then change <div id="comment-form"> to

    <?php if ( is_home() ) : ?>
    <div id="comment-form-<?php the_ID(); ?>" style="visibility: hidden;">
    <?php else : ?>
    <div id="comment-form">
    <?php endif; ?>

    3) It's now using #comments rather than #respond for the link again, so you'd need to reverse the very first fix I gave you. I have no idea why it changed though, it's a little worrying.

  18. Lance007
    Member
    Posted 4 years ago #

    Excellent - thanks. I'm going to make the changes and see what happens. Would be nice to know as much as you about this language.

    I just posted another story if you want to check it out.

    Do you have a blog or a website?

  19. Lance007
    Member
    Posted 4 years ago #

    Hmmmm,

    I just made the changes.

    1) Where the comment form used to be there is now a blank space. Is there a way to get rid of the blank space?

    2) when I click on "TWO COMMENTS" at the bottom of my first post, it takes me to the top of the page again. I guess I should change the "comments" back to "respond" in point 3 above?

    3) When I click on "COMMENTS" at the bottom of my second post, It takes me to the top of the page and thee is no form at all - no where to enter comments.

    Help please.
    thanks

  20. Lance007
    Member
    Posted 4 years ago #

    Here's my latest comments.php file:

    <?php
    if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
    die (__('Please do not load this page directly.', 'emerald_stretch'));

    if (!empty($post->post_password)) {
    if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) {
    ?>
    <p><?php _e('This post is password protected. Enter the password to read comments.', 'emerald_stretch'); ?></p>
    <?php
    return;
    }
    }
    $oddcomment = 'alt';
    ?>

    <div id="respond">

    <?php if ($comments) : ?>
    <h1><?php comments_number(__('No Responses','emerald_stretch'), __('One Response','emerald_stretch'), __('% Responses','emerald_stretch')); //_e(' to “','emerald_stretch'); the_title(); _e('”', 'emerald_stretch'); ?></h1>
    <div id="comment-area">

      <?php foreach ($comments as $comment) : ?>
      <li class="<?php echo $oddcomment; ?> <?php if (function_exists('author_highlight')) { ?> <?php author_highlight(); ?><?php } ?>" id="comment-<?php comment_ID() ?>">

      <p class="commenter"><?php echo get_avatar( $comment, 48 ); ?> <?php comment_author_link() ?><span class="comment-info"> - <?php comment_date(__('F j, Y', 'emerald_stretch')) ?></span></p>
      <?php if ($comment->comment_approved == '0') : ?>
      <span class="comment-moderation"><?php _e('••• Your comment is awaiting moderation •••', 'emerald_stretch'); ?></span>
      <?php endif; ?>
      <?php comment_text() ?>

      <?php
      if ('alt' == $oddcomment) $oddcomment = '';
      else $oddcomment = 'alt';
      ?>

      <?php
      if ( is_home() ) {
      static $comment_output_count = 0;
      $comment_output_count++;
      if ( $comment_output_count == 3 )
      break;
      }
      ?>

      <?php endforeach; ?>

    </div>

    <?php if ( !is_home() ) : ?>

    <?php if ('closed' == $post->comment_status) : ?>
    <!-- <h3><?php _e('Comments are closed for this entry.', 'emerald_stretch'); ?></h3> -->
    </div>
    <?php endif; ?>

    <?php else : ?>
    <?php if ('open' == $post->comment_status) : ?>
    <?php else : ?>
    <!-- <h3><?php _e('Comments are closed for this entry.', 'emerald_stretch'); ?></h3> -->
    </div>
    <?php endif; ?>
    <?php endif; ?>

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

    <?php if ( is_home() ) : ?>').style.visibility = 'visible'">Post comment<?php endif; ?>

    <?php if ( is_home() ) : ?>
    <div id="comment-form-<?php the_ID(); ?>" style="visibility: hidden;">
    <?php else : ?>
    <div id="comment-form">
    <?php endif; ?>
    <h1><?php _e('Post a Comment', 'emerald_stretch'); ?></h1>
    <?php if ( get_option('comment_registration') && !$user_ID ) : ?>
    <p><?php _e('You must be', 'emerald_stretch'); ?> /wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>"><?php _e('logged in', 'emerald_stretch'); ?><?php _e(' to post a comment', 'emerald_stretch'); ?>.</p>
    </div>
    <?php else : ?>
    <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
    <?php if ( $user_ID ) : ?>
    <p><?php _e('Logged in as', 'emerald_stretch'); ?> /wp-admin/profile.php"><?php echo $user_identity; ?>. <?php wp_loginout(); ?>.<!-- /wp-login.php?action=logout" title="<?php _e('Log out of this account', 'emerald_stretch'); ?>"><?php _e('Log out »', 'emerald_stretch'); ?> --></p>
    <?php else : ?>
    <p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="30" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />
    <label for="author"><?php _e('Name', 'emerald_stretch'); ?><?php if ($req) _e(', required', 'emerald_stretch'); ?></label></p>
    <p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="30" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />
    <label for="email"><?php _e('Email (will not be published)', 'emerald_stretch'); ?><?php if ($req) _e(', required', 'emerald_stretch'); ?></label></p>
    <p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="30" tabindex="3" />
    <label for="url"><?php _e('Your Website (optional)', 'emerald_stretch'); ?></label></p>
    <?php endif; ?>
    <p><textarea name="comment" id="comment" cols="60" rows="10" tabindex="4"></textarea></p>
    <?php do_action('comment_form', $post->ID); ?>
    <p>
    <input name="submit" class="button" type="submit" id="submit" tabindex="5" value="<?php _e('Submit', 'emerald_stretch'); ?>" />
    <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
    </p>
    </form>
    </div>
    <?php endif; ?>

    </div>
    <?php endif; ?>

    <?php else : ?>
    </div>
    <?php endif; ?>

  21. Lance007
    Member
    Posted 4 years ago #

    And if you have some time and know about rss issues, please check out my question under "RSS FEED NOT WORKING" posting - I'm dying over here.

  22. Lance007
    Member
    Posted 4 years ago #

    Kawauso,
    By the way - I have no problem paying you for your help. I have a paypal account.

    thanks

    Lance

  23. Adam Harley
    Member
    Posted 4 years ago #

    Your code seems to have gotten messed up when you posted it, could you repost it inside <code> and </code> for me?

    Looks like esmi managed to resolve your RSS feed issues :)

    Just give some money to a cancer research charity if you want to pay someone :)

    I'll try and work out what's up with the code, but if you could post your index.php as well that'd be a lot easier to work with.

  24. Lance007
    Member
    Posted 4 years ago #

    Funny you should mention cancer research. My friend recently sent me a donation link for a cancer charity because he is participating in a run. I will now definitely donate some money.

    Curious - is there any way to set up something on this support site that sends me an email when someone posts something to a thread I started?

    Thanks again for your help.

    Here is my comments.php:


    <?php
    if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
    die (__('Please do not load this page directly.', 'emerald_stretch'));

    if (!empty($post->post_password)) {
    if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) {
    ?>
    <p><?php _e('This post is password protected. Enter the password to read comments.', 'emerald_stretch'); ?></p>
    <?php
    return;
    }
    }
    $oddcomment = 'alt';
    ?>

    <div id="respond">

    <?php if ($comments) : ?>
    <h1><?php comments_number(__('No Responses','emerald_stretch'), __('One Response','emerald_stretch'), __('% Responses','emerald_stretch')); //_e(' to “','emerald_stretch'); the_title(); _e('”', 'emerald_stretch'); ?></h1>
    <div id="comment-area">

      <?php foreach ($comments as $comment) : ?>
      <li class="<?php echo $oddcomment; ?> <?php if (function_exists('author_highlight')) { ?> <?php author_highlight(); ?><?php } ?>" id="comment-<?php comment_ID() ?>">

      <p class="commenter"><?php echo get_avatar( $comment, 48 ); ?> <?php comment_author_link() ?><span class="comment-info"> - <?php comment_date(__('F j, Y', 'emerald_stretch')) ?></span></p>
      <?php if ($comment->comment_approved == '0') : ?>
      <span class="comment-moderation"><?php _e('••• Your comment is awaiting moderation •••', 'emerald_stretch'); ?></span>
      <?php endif; ?>
      <?php comment_text() ?>

      <?php
      if ('alt' == $oddcomment) $oddcomment = '';
      else $oddcomment = 'alt';
      ?>

      <?php
      if ( is_home() ) {
      static $comment_output_count = 0;
      $comment_output_count++;
      if ( $comment_output_count == 3 )
      break;
      }
      ?>

      <?php endforeach; ?>

    </div>

    <?php if ( !is_home() ) : ?>

    <?php if ('closed' == $post->comment_status) : ?>
    <!-- <h3><?php _e('Comments are closed for this entry.', 'emerald_stretch'); ?></h3> -->
    </div>
    <?php endif; ?>

    <?php else : ?>
    <?php if ('open' == $post->comment_status) : ?>
    <?php else : ?>
    <!-- <h3><?php _e('Comments are closed for this entry.', 'emerald_stretch'); ?></h3> -->
    </div>
    <?php endif; ?>
    <?php endif; ?>

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

    <?php if ( is_home() ) : ?>').style.visibility = 'visible'">Post comment<?php endif; ?>

    <?php if ( is_home() ) : ?>
    <div id="comment-form-<?php the_ID(); ?>" style="visibility: hidden;">
    <?php else : ?>
    <div id="comment-form">
    <?php endif; ?>
    <h1><?php _e('Post a Comment', 'emerald_stretch'); ?></h1>
    <?php if ( get_option('comment_registration') && !$user_ID ) : ?>
    <p><?php _e('You must be', 'emerald_stretch'); ?> /wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>"><?php _e('logged in', 'emerald_stretch'); ?><?php _e(' to post a comment', 'emerald_stretch'); ?>.</p>
    </div>
    <?php else : ?>
    <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
    <?php if ( $user_ID ) : ?>
    <p><?php _e('Logged in as', 'emerald_stretch'); ?> /wp-admin/profile.php"><?php echo $user_identity; ?>. <?php wp_loginout(); ?>.<!-- /wp-login.php?action=logout" title="<?php _e('Log out of this account', 'emerald_stretch'); ?>"><?php _e('Log out »', 'emerald_stretch'); ?> --></p>
    <?php else : ?>
    <p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="30" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />
    <label for="author"><?php _e('Name', 'emerald_stretch'); ?><?php if ($req) _e(', required', 'emerald_stretch'); ?></label></p>
    <p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="30" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />
    <label for="email"><?php _e('Email (will not be published)', 'emerald_stretch'); ?><?php if ($req) _e(', required', 'emerald_stretch'); ?></label></p>
    <p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="30" tabindex="3" />
    <label for="url"><?php _e('Your Website (optional)', 'emerald_stretch'); ?></label></p>
    <?php endif; ?>
    <p><textarea name="comment" id="comment" cols="60" rows="10" tabindex="4"></textarea></p>
    <?php do_action('comment_form', $post->ID); ?>
    <p>
    <input name="submit" class="button" type="submit" id="submit" tabindex="5" value="<?php _e('Submit', 'emerald_stretch'); ?>" />
    <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
    </p>
    </form>
    </div>
    <?php endif; ?>

    </div>
    <?php endif; ?>

    <?php else : ?>
    </div>
    <?php endif; ?>

    ------------------------------
    And here is my index.php file:

    <?php get_header(); ?>

    <!-- CONTENT -->

    <div id="content-wrapper">
    <div id="content">

    Bottom of Page

    <div style="height:8px;"></div>

    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <h1>" rel="bookmark" title="<?php _e('Permanent Link to ','emerald_stretch'); ?><?php the_title(); ?>"><?php the_title(); ?></h1>
    <?php the_content(__('Read the rest of this post »','emerald_stretch')); ?>
    <?php $withcomments = true; comments_template(); ?>
    <p id="postmeta">
    <img src="<?php bloginfo('template_directory'); ?>/img/calendar.gif" />/<?php the_time('Y') ?>/<?php the_time('m') ?>/" title="<?php _e('View all posts for the month of','emerald_stretch'); ?> <?php the_time(__('F, Y','emerald_stretch')) ?>"><?php the_time(__('F j, Y','emerald_stretch')) ?>
     <img src="<?php bloginfo('template_directory'); ?>/img/tag.gif" /><?php the_tags(__('Tags','emerald_stretch') . ': ', ', ', ' '); ?>
    <?php _e('Posted in', 'emerald_stretch'); ?>: <?php the_category(', ') ?>
     <img src="<?php bloginfo('template_directory'); ?>/img/comments.gif" /><?php comments_popup_link(__('COMMENTS','emerald_stretch'), __('ONE COMMENT','emerald_stretch'), __('% COMMENTS','emerald_stretch'), '', __('Comments Closed', 'emerald_stretch')); ?>
    <span class="editlink"><?php edit_post_link(__('Edit','emerald_stretch'),'',''); ?></span>
    </p>

    <?php endwhile; ?>
    Top of Page

    <ul class="postnav">
    <li class="left"><?php next_posts_link(__('« Older Entries','emerald_stretch')) ?>
    <li class="right"><?php previous_posts_link(__('Newer Entries »','emerald_stretch')) ?>

    <?php else : ?>
    <h1><?php _e('Oops! This blog is brand new','emerald_stretch'); ?></h1>
    <p><?php _e('No posts were found.','emerald_stretch'); ?></p>
    <?php endif; ?>

    </div>

    <!-- /CONTENT -->
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>


  25. Adam Harley
    Member
    Posted 4 years ago #

    Okay... that still screwed up. Hmm. Can you try using backticks (see the bottom of the post form) around the entire thing instead? It's still screwing things up quite badly, sorry.

  26. Lance007
    Member
    Posted 4 years ago #

    Ok - I have tried again below. If you give me an email address I can send it to you in a text document.

    Here you go:
    Comments.php:

    <?php
    	if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
    		die (__('Please do not load this page directly.', 'emerald_stretch'));
    
            if (!empty($post->post_password)) {
                if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) {
    				?>
    				<p><?php _e('This post is password protected. Enter the password to read comments.', 'emerald_stretch'); ?></p>
    				<?php
    				return;
                }
            }
    		$oddcomment = 'alt';
    ?>
    
    <div id="respond">
    
    	<?php if ($comments) : ?>
    		<h1><?php comments_number(__('No Responses','emerald_stretch'), __('One Response','emerald_stretch'), __('% Responses','emerald_stretch')); //_e(' to “','emerald_stretch'); the_title(); _e('”', 'emerald_stretch'); ?></h1>
    		<div id="comment-area">
    			<ol>
    			<?php foreach ($comments as $comment) : ?>
    				<li class="<?php echo $oddcomment; ?> <?php if (function_exists('author_highlight')) { ?> <?php author_highlight(); ?><?php } ?>" id="comment-<?php comment_ID() ?>">
    
    					<p class="commenter"><?php echo get_avatar( $comment, 48 ); ?> <?php comment_author_link() ?><span class="comment-info"> - <?php comment_date(__('F j, Y', 'emerald_stretch')) ?></span></p>
    					<?php if ($comment->comment_approved == '0') : ?>
    						<span class="comment-moderation"><?php _e('••• Your comment is awaiting moderation •••', 'emerald_stretch'); ?></span>
    					<?php endif; ?>
    					<?php comment_text() ?>
    				</li>
    
    				<?php
    					if ('alt' == $oddcomment) $oddcomment = '';
    					else $oddcomment = 'alt';
    				?>
    
    <?php
    if ( is_home() ) {
      static $comment_output_count = 0;
      $comment_output_count++;
      if ( $comment_output_count == 3 )
        break;
    }
    ?>
    
    			<?php endforeach; ?>
    			</ol>
    		</div>
    
    <?php if ( !is_home() ) : ?>
    
    	<?php if ('closed' == $post->comment_status) : ?>
    		<!-- <h3><?php _e('Comments are closed for this entry.', 'emerald_stretch'); ?></h3> -->
    		</div>
    	<?php endif; ?>
    
    	<?php else : ?>
    		<?php if ('open' == $post->comment_status) : ?>
    		<?php else : ?>
    			<!-- <h3><?php _e('Comments are closed for this entry.', 'emerald_stretch'); ?></h3> -->
      		</div>
    		<?php endif; ?>
    	<?php endif; ?>
    
    	<?php if ('open' == $post->comment_status) : ?>
    
    <?php if ( is_home() ) : ?><a href="javascript:void()" onclick="document.getElementById('comment-form-<?php the_ID(); ?>').style.visibility = 'visible'">Post comment</a><?php endif; ?>
    
    <?php if ( is_home() ) : ?>
    <div id="comment-form-<?php the_ID(); ?>" style="visibility: hidden;">
    <?php else : ?>
    <div id="comment-form">
    <?php endif; ?>
    			<h1><?php _e('Post a Comment', 'emerald_stretch'); ?></h1>
    			<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
          <p><?php _e('You must be', 'emerald_stretch'); ?> <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>"><?php _e('logged in', 'emerald_stretch'); ?></a><?php _e(' to post a comment', 'emerald_stretch'); ?>.</p>
    		</div>
    	<?php else : ?>
    		<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
    			<?php if ( $user_ID ) : ?>
            <p><?php _e('Logged in as', 'emerald_stretch'); ?> <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <?php wp_loginout(); ?>.<!-- <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="<?php _e('Log out of this account', 'emerald_stretch'); ?>"><?php _e('Log out &raquo;', 'emerald_stretch'); ?></a> --></p>
    			<?php else : ?>
            <p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="30" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />
            <label for="author"><?php _e('Name', 'emerald_stretch'); ?><?php if ($req) _e(', required', 'emerald_stretch'); ?></label></p>
            <p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="30" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />
            <label for="email"><?php _e('Email (will not be published)', 'emerald_stretch'); ?><?php if ($req) _e(', required', 'emerald_stretch'); ?></label></p>
            <p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="30" tabindex="3" />
            <label for="url"><?php _e('Your Website (optional)', 'emerald_stretch'); ?></label></p>
    			<?php endif; ?>
    				<p><textarea name="comment" id="comment" cols="60" rows="10" tabindex="4"></textarea></p>
    				<?php do_action('comment_form', $post->ID); ?>
    				<p>
    					<input name="submit" class="button" type="submit" id="submit" tabindex="5" value="<?php _e('Submit', 'emerald_stretch'); ?>" />
    					<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
    				</p>
    		</form>
    	</div>
    	<?php endif; ?>
    
    </div>
    <?php endif; ?>
    
    <?php else : ?>
    </div>
    <?php endif; ?>

    --------------
    and Index.php

    <?php get_header(); ?>
    
    <!-- CONTENT -->
    
      <div id="content-wrapper">
        <div id="content">
    
    <a href="#bottom">Bottom of Page</a>
    
    <div style="height:8px;"></div>
    
        	<?php if (have_posts()) : ?>
        		<?php while (have_posts()) : the_post(); ?>
        			<h1><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e('Permanent Link to ','emerald_stretch'); ?><?php the_title(); ?>"><?php the_title(); ?></a></h1>
        			<?php the_content(__('Read the rest of this post &raquo;','emerald_stretch')); ?>
    <?php $withcomments = true; comments_template(); ?>
        			<p id="postmeta">
    					  <img src="<?php bloginfo('template_directory'); ?>/img/calendar.gif" /><a href="<?php bloginfo('url'); ?>/<?php the_time('Y') ?>/<?php the_time('m') ?>/" title="<?php _e('View all posts for the month of','emerald_stretch'); ?> <?php the_time(__('F, Y','emerald_stretch')) ?>"><?php the_time(__('F j, Y','emerald_stretch')) ?></a>
    					  &nbsp;<img src="<?php bloginfo('template_directory'); ?>/img/tag.gif" /><?php the_tags(__('Tags','emerald_stretch') . ':&nbsp;', ', ', '&nbsp;'); ?>
                <?php _e('Posted&nbsp;in', 'emerald_stretch'); ?>:&nbsp;<?php the_category(', ') ?>
    					  &nbsp;<img src="<?php bloginfo('template_directory'); ?>/img/comments.gif" /><?php comments_popup_link(__('COMMENTS','emerald_stretch'), __('ONE COMMENT','emerald_stretch'), __('% COMMENTS','emerald_stretch'), '', __('Comments Closed', 'emerald_stretch')); ?>
    					  <span class="editlink"><?php edit_post_link(__('Edit','emerald_stretch'),'',''); ?></span>
    				  </p>
    
        		<?php endwhile; ?>
    <a href="#top">Top of Page</a>
     		  <br />
    			<ul class="postnav">
     				<li class="left"><?php next_posts_link(__('&laquo; Older Entries','emerald_stretch')) ?></li>
      			<li class="right"><?php previous_posts_link(__('Newer Entries &raquo;','emerald_stretch')) ?></li>
    			</ul>
    
    		<?php else : ?>
    			  <h1><?php _e('Oops! This blog is brand new','emerald_stretch'); ?></h1>
    			  <p><?php _e('No posts were found.','emerald_stretch'); ?></p>
    		<?php endif; ?>
    
        </div>
    
    <!-- /CONTENT -->
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
    
    <a name="bottom"></a>
  27. Adam Harley
    Member
    Posted 4 years ago #

    Cheers much easier to work with :) I'll try and fix things in a bit

  28. Lance007
    Member
    Posted 4 years ago #

    Great Thanks.
    You didn't answer whether there's a way to set up an email notification when someone posts on a thread I started? How am I supposed to know when people answer my questions?

  29. Adam Harley
    Member
    Posted 4 years ago #

    I don't think there is. There is your profile though: http://wordpress.org/support/profile/3966674

  30. Adam Harley
    Member
    Posted 4 years ago #

    comments.php

    <?php
    	if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
    		die (__('Please do not load this page directly.', 'emerald_stretch'));
    
            if (!empty($post->post_password)) {
                if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) {
    				?>
    				<p><?php _e('This post is password protected. Enter the password to read comments.', 'emerald_stretch'); ?></p>
    				<?php
    				return;
                }
            }
    		$oddcomment = 'alt';
    ?>
    
    <div id="respond"></div>
    <div id="comments">
    
    	<?php if ($comments) : ?>
    		<h1><?php comments_number(__('No Responses','emerald_stretch'), __('One Response','emerald_stretch'), __('% Responses','emerald_stretch')); //_e(' to “','emerald_stretch'); the_title(); _e('”', 'emerald_stretch'); ?></h1>
    		<div id="comment-area">
    			<ol>
    			<?php foreach ($comments as $comment) : ?>
    				<li class="<?php echo $oddcomment; ?> <?php if (function_exists('author_highlight')) { ?> <?php author_highlight(); ?><?php } ?>" id="comment-<?php comment_ID() ?>">
    
    					<p class="commenter"><?php echo get_avatar( $comment, 48 ); ?> <?php comment_author_link() ?><span class="comment-info"> - <?php comment_date(__('F j, Y', 'emerald_stretch')) ?></span></p>
    					<?php if ($comment->comment_approved == '0') : ?>
    						<span class="comment-moderation"><?php _e('••• Your comment is awaiting moderation •••', 'emerald_stretch'); ?></span>
    					<?php endif; ?>
    					<?php comment_text() ?>
    				</li>
    
    				<?php
    					if ('alt' == $oddcomment) $oddcomment = '';
    					else $oddcomment = 'alt';
    				?>
    
    			<?php
    			if ( is_home() ) {
    			  static $comment_output_count = 0;
    			  $comment_output_count++;
    			  if ( $comment_output_count == 3 ) {
    				break;
    			  }
    			}
    			?>
    
    			<?php endforeach; ?>
    			<?php unset($comment_output_count); ?>
    			</ol>
    		</div>
    
    	<?php if ('closed' == $post->comment_status) : ?>
    		<!-- <h3><?php _e('Comments are closed for this entry.', 'emerald_stretch'); ?></h3> -->
    		</div>
    	<?php endif; ?>
    
    	<?php else : ?>
    		<?php if ('open' == $post->comment_status) : ?>
    		<?php else : ?>
    			<!-- <h3><?php _e('Comments are closed for this entry.', 'emerald_stretch'); ?></h3> -->
      		</div>
    		<?php endif; ?>
    	<?php endif; ?>
    
    	<?php if ('open' == $post->comment_status) : ?>
    
    			<?php if ( is_home() ) : ?><a href="javascript:void()" onclick="document.getElementById('comment-form-<?php the_ID(); ?>').style.display = 'block'"><h1><?php _e('Post a Comment', 'emerald_stretch'); ?></h1></a><?php endif; ?>
    
    			<?php if ( is_home() ) : ?>
    			<div id="comment-form-<?php the_ID(); ?>" style="display:none">
    			<?php else : ?>
    			<div id="comment-form">
    			<?php endif; ?>
    			<?php if ( !is_home() ) : ?><h1><?php _e('Post a Comment', 'emerald_stretch'); ?></h1><?php endif; ?>
    			<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
          <p><?php _e('You must be', 'emerald_stretch'); ?> <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>"><?php _e('logged in', 'emerald_stretch'); ?></a><?php _e(' to post a comment', 'emerald_stretch'); ?>.</p>
    		</div>
    	<?php else : ?>
    		<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
    			<?php if ( $user_ID ) : ?>
            <p><?php _e('Logged in as', 'emerald_stretch'); ?> <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <?php wp_loginout(); ?>.<!-- <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="<?php _e('Log out of this account', 'emerald_stretch'); ?>"><?php _e('Log out &raquo;', 'emerald_stretch'); ?></a> --></p>
    			<?php else : ?>
            <p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="30" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />
            <label for="author"><?php _e('Name', 'emerald_stretch'); ?><?php if ($req) _e(', required', 'emerald_stretch'); ?></label></p>
            <p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="30" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />
            <label for="email"><?php _e('Email (will not be published)', 'emerald_stretch'); ?><?php if ($req) _e(', required', 'emerald_stretch'); ?></label></p>
            <p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="30" tabindex="3" />
            <label for="url"><?php _e('Your Website (optional)', 'emerald_stretch'); ?></label></p>
    			<?php endif; ?>
    				<p><textarea name="comment" id="comment" cols="60" rows="10" tabindex="4"></textarea></p>
    				<?php do_action('comment_form', $post->ID); ?>
    				<p>
    					<input name="submit" class="button" type="submit" id="submit" tabindex="5" value="<?php _e('Submit', 'emerald_stretch'); ?>" />
    					<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
    				</p>
    		</form>
    	</div>
    	<?php endif; ?>
    
    </div>
    
    <?php else : ?>
    </div>
    <?php endif; ?>

    index.php

    <?php get_header(); ?>
    
    <!-- CONTENT -->
    
      <div id="content-wrapper">
        <div id="content">
    
    <a href="#bottom">Bottom of Page</a>
    
    <div style="height:8px;"></div>
    
        	<?php if (have_posts()) : ?>
        		<?php while (have_posts()) : the_post(); ?>
        			<h1><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e('Permanent Link to ','emerald_stretch'); ?><?php the_title(); ?>"><?php the_title(); ?></a></h1>
        			<?php the_content(__('Read the rest of this post &raquo;','emerald_stretch')); ?>
        			<p id="postmeta">
    					  <img src="<?php bloginfo('template_directory'); ?>/img/calendar.gif" /><a href="<?php bloginfo('url'); ?>/<?php the_time('Y') ?>/<?php the_time('m') ?>/" title="<?php _e('View all posts for the month of','emerald_stretch'); ?> <?php the_time(__('F, Y','emerald_stretch')) ?>"><?php the_time(__('F j, Y','emerald_stretch')) ?></a>
    					  &nbsp;<img src="<?php bloginfo('template_directory'); ?>/img/tag.gif" /><?php the_tags(__('Tags','emerald_stretch') . ':&nbsp;', ', ', '&nbsp;'); ?>
                <?php _e('Posted&nbsp;in', 'emerald_stretch'); ?>:&nbsp;<?php the_category(', ') ?>
    					  &nbsp;<img src="<?php bloginfo('template_directory'); ?>/img/comments.gif" /><?php comments_popup_link(__('COMMENTS','emerald_stretch'), __('ONE COMMENT','emerald_stretch'), __('% COMMENTS','emerald_stretch'), '', __('Comments Closed', 'emerald_stretch')); ?>
    					  <span class="editlink"><?php edit_post_link(__('Edit','emerald_stretch'),'',''); ?></span>
    				  </p>
    				<?php $withcomments = true; comments_template(); ?>
    
        		<?php endwhile; ?>
    			<a href="#top">Top of Page</a>
     		  <br />
    			<ul class="postnav">
     				<li class="left"><?php next_posts_link(__('&laquo; Older Entries','emerald_stretch')) ?></li>
      			<li class="right"><?php previous_posts_link(__('Newer Entries &raquo;','emerald_stretch')) ?></li>
    			</ul>
    
    		<?php else : ?>
    			  <h1><?php _e('Oops! This blog is brand new','emerald_stretch'); ?></h1>
    			  <p><?php _e('No posts were found.','emerald_stretch'); ?></p>
    		<?php endif; ?>
    
        </div>
    
    <!-- /CONTENT -->
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
    
    <a name="bottom"></a>

    I changed the new comment link to be bigger, just take out the <h1> tag around it if you want it normal size. Take out the <?php if ( !is_home() ) : ?> and <?php endif; ?> lower down to put back the Post a Comment title back on the main page too.

Topic Closed

This topic has been closed to new replies.

About this Topic