WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How To Add Time/Date Stamp to Comments.php (13 posts)

  1. maguiresc
    Member
    Posted 3 years ago #

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

    Thanks!

  2. keesiemeijer
    moderator
    Posted 3 years ago #

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

  3. maguiresc
    Member
    Posted 3 years ago #

    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; ?>
  4. maguiresc
    Member
    Posted 3 years ago #

  5. keesiemeijer
    moderator
    Posted 3 years ago #

    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

  6. maguiresc
    Member
    Posted 3 years ago #

    functions.php

    Thanks I really appreciate this!

  7. keesiemeijer
    moderator
    Posted 3 years ago #

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

  8. maguiresc
    Member
    Posted 3 years ago #

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

  9. keesiemeijer
    moderator
    Posted 3 years ago #

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

  10. maguiresc
    Member
    Posted 3 years ago #

    custom.lib.php

    Line 221 Shows pp_comment, how would I integrate that?

  11. keesiemeijer
    moderator
    Posted 3 years ago #

    try it with this: custom.lib.php

  12. maguiresc
    Member
    Posted 3 years ago #

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

  13. keesiemeijer
    moderator
    Posted 3 years ago #

    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>

Topic Closed

This topic has been closed to new replies.

About this Topic