Support » Fixing WordPress » How To Add Time/Date Stamp to Comments.php

  • Resolved maguiresc

    (@maguiresc)


    How can I add a time and date stamp to my wordpress comments.php, and where should it be inserted in the loop?

    Thanks!

Viewing 12 replies - 1 through 12 (of 12 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    moderator

    Can you put your theme’s comments.php in the pasetebin and give us the link to it.

    maguiresc

    (@maguiresc)

    Thanks… Its trevoralves.com

    The code is as follows for comments.php:

    <?php
    if ( post_password_required() ) { ?>
    	<p>This post is password protected. Enter the password to view comments.</p>
    <?php
    	return;
    }
    
    if( have_comments() ) : ?> 
    
    					<h5 class="cufon"><?php comments_number('No comment', 'Comment', '% Comments'); ?> for <?php the_title(); ?></h5><br/>
    
    					<?php wp_list_comments( array('callback' => 'pp_comment', 'avatar_size' => '40') ); ?>
    
    					<!-- End of thread -->
    					<br class="clear"/><br/>
    <?php endif; ?>  
    
    <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
    			<div class="pagination"><p><?php previous_comments_link(); ?> <?php next_comments_link(); ?></p></div><br class="clear"/><div class="line"></div><br/><br/>
    <?php endif; // check for comment navigation ?>
    
    <?php if ('open' == $post->comment_status) : ?> 
    
    		<div id="respond">
    			<?php include(TEMPLATEPATH . '/templates/comments-form.php'); ?>
    		</div>
    
    <?php endif; ?>

    maguiresc

    (@maguiresc)

    Moderator keesiemeijer

    (@keesiemeijer)

    moderator

    Your comments are made by the callback function pp_comment. You can find it in your theme’s functions.php. Something like this:

    function pp_comment(..) {
    // content of the function
    }

    Can you put it in the pastebin

    maguiresc

    (@maguiresc)

    functions.php

    Thanks I really appreciate this!

    Moderator keesiemeijer

    (@keesiemeijer)

    moderator

    The function is not in there. I see you use the premium (paid for) theme Pleng. Did you ask there for a solution?

    maguiresc

    (@maguiresc)

    Yes, and unfortunately he is not able to assist. Is there a way to manually code the script into the functions.php page?

    Moderator keesiemeijer

    (@keesiemeijer)

    moderator

    You can search your theme for this function: function pp_comment()

    maguiresc

    (@maguiresc)

    custom.lib.php

    Line 221 Shows pp_comment, how would I integrate that?

    Moderator keesiemeijer

    (@keesiemeijer)

    moderator

    try it with this: custom.lib.php

    maguiresc

    (@maguiresc)

    That worked! Thanks! Do you mind me asking what code you used so I can reference for next time.

    Moderator keesiemeijer

    (@keesiemeijer)

    moderator

    I changed this:

    <strong><i><?php echo $comment->comment_author; ?></i></strong>

    to this:

    <strong><i><?php printf(__('By %1$s on %2$s at %3$s'),
    					get_comment_author_link(),
    					get_comment_date('d M Y'),
    					get_comment_time('g:i a')); ?></i></strong>

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘How To Add Time/Date Stamp to Comments.php’ is closed to new replies.