• Guys –

    Check out this screenshot:
    http://imgur.com/cu27l.png

    See the words “Log in to reply”?

    I want to edit those words to say something else…. trouble is I have scoured the theme – comments.php, functions.php and can not find them ANYWHERE. Is this some standard language you can’t edit? Or is it just buried god knows where?

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Look in your theme’s comments.php for “wp_list_comments”.

    If it looks like this:
    wp_list_comments();

    Then change it to this:

    wp_list_comments(array(
    'login_text' => 'Login and then you can reply, buddy!',
    ));

    If it already has an array of stuff on it, or some other string, then add the login_text parameter to that array or string.

    Thread Starter nickaster

    (@nickaster)

    Brillant, thanks Otto ….

    Here’s what I have:

    wp_list_comments('type=comment&callback=sdac_comment');

    What’s that junk in there? I think it’s coming from something custom in the theme, but I can’t figure out why… the extra problem is that I don’t only want to change the text – what I’d also like is to add a second option, ie:

    “login here …. or click this to register if you’re new”

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Changing the text is easy. Example:
    wp_list_comments('type=comment&callback=sdac_comment&login_text=EXAMPLE');

    Adding new functionality is more difficult.

    Look throughout your theme for the sdac_comment function. In there, there will be a call to “comment_reply_link”. That function call is what prints the reply link (using the text from the login_text parameter), so if you want to add something else there that is not a reply link, like a link to the register page, then you can add the code before or after that function call.

    Thread Starter nickaster

    (@nickaster)

    Thanks! Man, this is frying my brain… so… if you still have a second. Here’s the whole function, as far as I can tell:

    function sdac_comment($comment, $args, $depth) {
       $GLOBALS['comment'] = $comment;
       ?>
       <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
         <div id="comment-<?php comment_ID(); ?>" class="completeComment">
         		<div class="gravatar">
    			<?php if (function_exists('get_avatar') && get_option('show_avatars')) { echo get_avatar($comment, 32); } ?>
    			</div>
    			<div class="commentBox">
    				<p class="commentMeta"><?php comment_time('F d, Y');?> at <?php comment_time('G:i a T');?> | <?php comment_author_link();?> writes:</p>
    				<?php if ($comment->comment_approved == '0') : ?>
             		<p><?php _e('Your comment is awaiting moderation.') ?></p>
          			<?php endif; ?>
    				<?php comment_text(); ?>
    				<p class="reply"> <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?> <?php edit_comment_link();?></p>
    			</div>
    		</div>
    	</li>
    <?php
            }

    I’m still totaly baffled as to where that wording is coming from? I see the “reply” part… but there’s nothing there that would seem to me to produce that text….I guess I could hard-code something in right?

    Thread Starter nickaster

    (@nickaster)

    Ha! I got it! I just did this:

    <p class="reply"> <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?> Or <a href="LINK TO REGISTRATION">REGISTER HERE</a> if you are new.<?php edit_comment_link();?></p>

    I reckon, however, that’s a pretty ugly hack. Is there any reason I shouldn’t do it this way?

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    No, that is the correct way, basically. Since the theme is using a custom callback, it’s pretty much the only way.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Trying to understand comments template’ is closed to new replies.