Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #980326
    dmick89
    Participant

    Hi, I’d like to add the time the Ethos comments that people leave. Currently, the format is like this:

    Date
    Author

    I’d like it to be like this:

    Author
    Time on Date

    Attached is a screenshot from another theme of what I’d like.

    #980678
    Rue Nel
    Moderator

    Hello There,

    Thanks for writing in! You can change the time format in your settings. Please go to Settings > General and set the time and date.

    Or if still doesn’t work, please insert this following code in your child theme’s functions.php file.

    // Custom Ethos Comment Time
    // =============================================================================
    function x_ethos_comment( $comment, $args, $depth ) {
    
      $GLOBALS['comment'] = $comment;
      switch ( $comment->comment_type ) :
        case 'pingback' :  // 1
        case 'trackback' : // 1
      ?>
      <li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>">
        <p><?php _e( 'Pingback:', '__x__' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( '(Edit)', '__x__' ), '<span class="edit-link">', '</span>' ); ?></p>
      <?php
          break;
        default : // 2
        GLOBAL $post;
        if ( X_WOOCOMMERCE_IS_ACTIVE ) :
          $rating = esc_attr( get_comment_meta( $GLOBALS['comment']->comment_ID, 'rating', true ) );
        endif;
      ?>
      <li id="li-comment-<?php comment_ID(); ?>" <?php comment_class(); ?>>
        <article id="comment-<?php comment_ID(); ?>" class="comment">
          <?php
          printf( '<div class="x-comment-img">%1$s %2$s</div>',
            '<span class="avatar-wrap cf">' . get_avatar( $comment, 120 ) . '</span>',
            ( $comment->user_id === $post->post_author ) ? '<span class="bypostauthor">' . __( 'Author', '__x__' ) . '</span>' : ''
          );
          ?>
          <div class="x-comment-content-wrap">
            <header class="x-comment-header">
              <div class="x-comment-meta">
                <?php
                printf( '<a href="%1$s" class="x-comment-time"><time datetime="%2$s">%3$s at %4$s</time></a>',
                  esc_url( get_comment_link( $comment->comment_ID ) ),
                  get_comment_time( 'c' ),
                  sprintf( __( '%1$s', '__x__' ),
                    get_comment_date()
                  ),
                  get_comment_time( 'g:i a' )
                );
                ?>
                <?php if ( ! x_is_product() ) : ?>
                  <?php comment_reply_link( array_merge( $args, array( 'reply_text' => __( 'Reply <span class="comment-reply-link-after"><i class="x-icon-reply" data-x-icon=""></i></span>', '__x__' ), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
                <?php endif; ?>
                <?php edit_comment_link( __( 'Edit <i class="x-icon-edit" data-x-icon=""></i>', '__x__' ) ); ?>
              </div>
              <?php
              printf( '<cite class="x-comment-author">%1$s</cite>',
                get_comment_author_link()
              );
              ?>
              <?php if ( x_is_product() && get_option( 'woocommerce_enable_review_rating' ) == 'yes' ) : ?>
                <div class="star-rating-container">
                  <div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating" class="star-rating" title="<?php echo sprintf( __( 'Rated %d out of 5', '__x__' ), $rating ) ?>">
                    <span style="width:<?php echo ( intval( get_comment_meta( $GLOBALS['comment']->comment_ID, 'rating', true ) ) / 5 ) * 100; ?>%"><strong itemprop="ratingValue"><?php echo intval( get_comment_meta( $GLOBALS['comment']->comment_ID, 'rating', true ) ); ?></strong> <?php _e( 'out of 5', '__x__' ); ?></span>
                  </div>
                </div>
              <?php endif; ?>
            </header>
            <?php if ( '0' == $comment->comment_approved ) : ?>
              <p class="x-comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', '__x__' ); ?></p>
            <?php endif; ?>
            <section class="x-comment-content">
              <?php comment_text(); ?>
            </section>
          </div>
        </article>
      <?php
          break;
      endswitch;
    
    }
    // =============================================================================

    Hope this helps.

  • <script> jQuery(function($){ $("#no-reply-980326 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>