Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1308304
    flittrst
    Participant

    Hey there,

    I just recognized that every comment on my blog has the same day as date (seems like, that the actual date is used) but has different times.

    Please check here for an example: http://www.adsventure.de/facebook-pixel/#comment-221

    Every comment seems to be from today. But – as you can guess – thats wrong 😀

    How can I fix that?

    Many thanks,

    #1308314
    Christian
    Moderator

    Hey there,

    Would you mind providing us with WordPress Admin username / password so we can take a closer look?

    Thanks.

    #1308352
    flittrst
    Participant
    This reply has been marked as private.
    #1308367
    Christian
    Moderator

    It looks like there’s something in your site that affects the comment date. Please try testing for a plugin conflict. You can do this by deactivating all third party plugins, and seeing if the problem remains. If it’s fixed, you’ll know a plugin caused the problem, and you can narrow down which one by reactivating them one at a time.

    This does not happen on my test site so this is not a bug. Please also disable all customizations while investigating.

    Thanks.

    #1308500
    flittrst
    Participant

    Hey there,

    I’ve did exactly what you recommended and deactivated all the third party plugins but unfortunately this didn’t help. The displayed date is still from today.

    I also checked the customizations I’ve did. And I did change this in the functions.php of my child theme:

    function x_renew_entry_meta() {
    
        //
        // Author.
        //
    
        $author = sprintf( '<span><a href="http://www.adsventure.de/starte-hier/">%s</a></span>',
          get_the_author()
        );
    
        //
        // Date.
        //
    
        $date = sprintf( '<span><time class="entry-date" datetime="%1$s">%2$s</time></span>',
          esc_attr( get_the_date( 'c' ) ),
          esc_html( get_the_date() )
        );
    
        //
        // Categories.
        //
    
        if ( get_post_type() == 'x-portfolio' ) {
          if ( has_term( '', 'portfolio-category', NULL ) ) {
            $categories        = get_the_terms( get_the_ID(), 'portfolio-category' );
            $separator         = ', ';
            $categories_output = '';
            foreach ( $categories as $category ) {
              $categories_output .= '<a href="'
                                  . get_term_link( $category->slug, 'portfolio-category' )
                                  . '" title="'
                                  . esc_attr( sprintf( __( "View all posts in: &ldquo;%s&rdquo;", '__x__' ), $category->name ) )
                                  . '"> '
                                  . $category->name
                                  . '</a>'
                                  . $separator;
            }
    
            $categories_list = sprintf( '<span>%s</span>',
              trim( $categories_output, $separator )
            );
          } else {
            $categories_list = '';
          }
        } else {
          $categories        = get_the_category();
          $separator         = ', ';
          $categories_output = '';
          foreach ( $categories as $category ) {
            $categories_output .= '<a href="'
                                . get_category_link( $category->term_id )
                                . '" title="'
                                . esc_attr( sprintf( __( "View all posts in: &ldquo;%s&rdquo;", '__x__' ), $category->name ) )
                                . '">'
                                . $category->name
                                . '</a>'
                                . $separator;
          }
    
          $categories_list = sprintf( '<span>%s</span>',
            trim( $categories_output, $separator )
          );
        }
    
        //
        // Comments link.
        //
    
        if ( comments_open() ) {
    
          $title  = apply_filters( 'x_entry_meta_comments_title', get_the_title() );
          $link   = apply_filters( 'x_entry_meta_comments_link', get_comments_link() );
          $number = apply_filters( 'x_entry_meta_comments_number', get_comments_number() );
    
          if ( $number == 0 ) {
            $text = __( 'Leave a Comment' , '__x__' );
          } else if ( $number == 1 ) {
            $text = $number . ' ' . __( 'Comment' , '__x__' );
          } else {
            $text = $number . ' ' . __( 'Comments' , '__x__' );
          }
    
          $comments = sprintf( '<span><a href="%1$s" title="%2$s" class="meta-comments">%3$s</a></span>',
            esc_url( $link ),
            esc_attr( sprintf( __( 'Leave a comment on: &ldquo;%s&rdquo;', '__x__' ), $title ) ),
            $text
          );
    
        } else {
    
          $comments = '';
    
        }
    
        //
        // Output.
        //
    
        if ( x_does_not_need_entry_meta() ) {
          return;
        } else {
          printf( '<p class="p-meta">%1$s%2$s%3$s%4$s</p>',
            $author,
            $date,
            $categories_list,
            $comments
          );
        }
    
      }

    But also if I remove this, the problem still appears.

    Is there any other way to fix this problem?

    Thanks a lot!!!

    #1308528
    flittrst
    Participant

    P.S. I just found out, that even in the backend the date/timestamp is displayed wrong:

    #1308533
    Christian
    Moderator

    Regretfully, the only way would be to revert from a backup since comment dates are stored in the database. Otherwise, you need to manually edit the date of your comments.

    Thanks.

    #1308558
    flittrst
    Participant

    Yes, but the strange thing is: the comment dates are correctly stored into my database (here is what I see when I want to edit a comment):

    Is there any way to hide the date with css?

    #1308631
    Christian
    Moderator

    Not sure how the comment dates were modified since there is no function in X nor Cornerstone that could do that.

    To hide the comment date, please add the code below in your functions.php

    /* Renew Comment */
    
    function x_renew_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;
        if ( x_is_product() ) {
          $comment_avatar = get_avatar( $comment, 240 );
        } else {
          $comment_avatar = get_avatar( $comment, 120 );
        }
      ?>
      <li id="li-comment-<?php comment_ID(); ?>" itemprop="review" itemscope itemtype="http://schema.org/Review" <?php comment_class(); ?>>
        <article id="comment-<?php comment_ID(); ?>" class="comment">
          <?php
          printf( '<div class="x-comment-img">%s</div>',
            '<span class="avatar-wrap cf">' . $comment_avatar . '</span>'
          );
          ?>
          <?php if ( ! x_is_product() ) : ?>
          <div class="x-reply">
            <?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'] ) ) ); ?>
          </div>
          <?php endif; ?>
          <div class="x-comment-wrap">
            <header class="x-comment-header">
              <?php
              printf( '<cite class="x-comment-author" itemprop="author">%1$s</cite>',
                get_comment_author_link()
              );
              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;
              printf( '<div><a href="%1$s" class="x-comment-time"><time itemprop="datePublished" datetime="%2$s">%3$s</time></a></div>',
                esc_url( get_comment_link( $comment->comment_ID ) ),
                get_comment_time( 'c' ),
                sprintf( __( '%2$s', '__x__' ),
                  get_comment_date( 'm.d.Y' ),
                  get_comment_time()
                )
              );
              edit_comment_link( __( '<i class="x-icon-edit" data-x-icon=""></i> Edit', '__x__' ) );
              ?>
            </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" itemprop="description">
              <?php comment_text(); ?>
            </section>
          </div>
        </article>
      <?php
          break;
      endswitch;
    
    }

    Thanks.

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