Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1407682
    Chgrim
    Participant

    Hi,

    I just recently lost my rating serp on this page https://www.topdownreviews.com/avocado-mattress-review-green-organic-bed/ and I believe it’s because my comments section for xtheme has review schema on it.

    If you run that page through https://search.google.com/structured-data/testing-tool you can see that the comment by anglea is registering as a review and I believe screwing up my serp. Is this something that Xtheme does?

    Thanks so much!
    Chris

    #1408095
    Rupok
    Member

    Hi Chris,

    X using the default WordPress commenting system with some added style and it’s pretty simple. I think it’s being treated as review because of the title or content.

    Thanks!

    #1408233
    Chgrim
    Participant

    I’m not exactly sure what you mean since there is definitely custom schema added to the the comments section to make it read like that in the structured data tool. I guess what I am trying to figure out is if xtheme adds this schema or its one of the plugins I am using?

    Thanks
    Chris

    #1408426
    Rupok
    Member

    Hey Chris,

    Actually there is no such schema added by X. You can check the code for comment from x/framework/views/icon/wp-comments.php. I guess it’s being added by any plugin. I suspect “WP Performance Score Booster” as it supposed to do such thing.

    Cheers!

    #1408647
    Chgrim
    Participant

    Perfect! Thanks so much. I will investigate to which plugin is doing it.

    Thanks
    Chris

    #1408921
    Prasant Rai
    Moderator

    You are most welcome. 🙂

    #1409999
    Chgrim
    Participant

    Hi,

    So I did a test on this on my testing site http://www.chrisgrim.com/2017/03/15/zippered-clutch-purse/ and discovered even with all of my plugins turned off I am still getting the review schema for the comments section. ( I have turned the plugins back on now so I can keep tweaking things.)

    Are you sure Xtheme isnt adding this code?

    <h2 class="h-comments-title"><span>Comments <small>1</small></span></h2>
        <ol class="x-comments-list">
              <li id="li-comment-2" itemprop="review" itemscope itemtype="http://schema.org/Review"class="comment byuser comment-author-Chris bypostauthor even thread-even depth-1">

    Thanks
    Chris

    #1410624
    Rue Nel
    Moderator

    Hello Chris,

    Thanks for updating in! To resolve your issue, since you already have your child theme active and ready, please insert this following code in your child theme’s functions.php file.

    if ( ! function_exists( 'x_icon_comment' ) ) :
      function x_icon_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_time = sprintf( __( '%1$s', '__x__' ), get_comment_date() );
          else :
            $comment_time = sprintf( __( '%1$s at %2$s', '__x__' ), get_comment_date(), get_comment_time() );
          endif;
        ?>
        <li id="li-comment-<?php comment_ID(); ?>" <?php comment_class(); ?>>
          <?php $comment_reply = ( ! x_is_product() ) ? '<div class="x-reply">' . get_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
          printf( '<div class="x-comment-img">%1$s %2$s %3$s</div>',
            '<span class="avatar-wrap cf">' . get_avatar( $comment, 120 ) . '</span>',
            ( $comment->user_id === $post->post_author ) ? '<span class="bypostauthor">' . __( 'Post<br>Author', '__x__' ) . '</span>' : '',
            $comment_reply
          );
          ?>
          <article id="comment-<?php comment_ID(); ?>" class="comment">
            <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' ),
                $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>
          </article>
        <?php
            break;
        endswitch;
    
      }
    endif;

    We would loved to know if this has work for you. Thank you.

    #1410653
    Chgrim
    Participant

    Hi,

    Ok this is weird. I tried adding that code to my site http://www.chrisgrim.com and it worked but when I added it to my site http://www.topdownreviews.com it didn’t. Could it be conflicting with something on topdown?

    Thanks
    Chris

    #1410976
    Jade
    Moderator

    Hi Chris,

    Kindly provide us with the admin and FTP credentials to the site where the code is not working so that we could check it.

    Thank you.

    #1411222
    Chgrim
    Participant
    This reply has been marked as private.
    #1411817
    Rue Nel
    Moderator

    Hello There,

    Thanks for updating in! Since you have installed a caching plugin WP Super Cache, please clear your plugin cache before testing your site. This can cause the changes to not take place on the front end. It will eventually show up when the cache regenerates, but it’s not ideal if you’re looking to see your changes immediately. Caching plugins are best to turn on only when you’ve finished building the site.

    Please let us know how it goes.

    #1411820
    Chgrim
    Participant

    Hmm it seems to be working, sorry about that! I thought I did clear the cache.

    Thanks so much!!
    Chris

    #1412058
    Christopher
    Moderator

    You’re welcome.

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