Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #82308

    AJ M
    Participant

    Hi,

    In the past, all I have had to do to get Google to stop showing a time stamp for pages (and posts) in search results is install the Date Exclusion SEO Plugin and voilà, roughly one week later Google knocks this nonsense off. There have been a couple of instances for certain themes in which I have had to get into the appropriate files and change:

    <?php the_time('F jS, Y') ?>

    to:

    <script language="javascript" type="text/javascript">document.write("<?php the_time('F jS, Y') ?>");</script>

    This has, up until now, always been a universally similar process. These appropriate files within X, however, do not appear to be accessible due to the way the ‘stacks’ are set up (?).

    The former method, the plugin, I installed over a month ago and Google is still showing the date stamp. The latter method I have not been able to try as I can’t figure out how to access the Integrity-specific files, nor am I sure which files would need to be altered for the X theme.

    Please advise,
    AJ

    #82326

    Mrinal
    Member

    Hi AJ,

    I’m really sorry for the issue you’re facing!

    To do you need you need to create a child theme first, please follow this KB: http://theme.co/x/member/kb/how-to-setup-child-themes/ & create a child theme. Then open your child theme’s functions.php file & paste the following codes into it:

      function x_integrity_entry_meta() {
    
        $author = sprintf( '<span><i class="x-icon-pencil"></i> %s</span>',
          get_the_author()
        );
    
        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 ) )
                                  . '"><i class="x-icon-bookmark"></i> '
                                  . $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 ) )
                                . '"><i class="x-icon-bookmark"></i> '
                                . $category->name
                                . '</a>'
                                . $separator;
          }
    
          $categories_list = sprintf( '<span>%s</span>',
            trim( $categories_output, $separator )
          );
        }
    
        if ( comments_open() ) {
          $title  = get_the_title();
          $link   = get_comments_link();
          $number = get_comments_number();
          if ( $number == 0 ) {
            $comments = sprintf( '<span><a href="%1$s" title="%2$s" class="meta-comments"><i class="x-icon-comments"></i> %3$s</a></span>',
              esc_url( $link ),
              esc_attr( sprintf( __( 'Leave a comment on: &ldquo;%s&rdquo;', '__x__' ), $title ) ),
              __( 'Leave a Comment' , '__x__' )
            );
          } else if ( $number == 1 ) {
            $comments = sprintf( '<span><a href="%1$s" title="%2$s" class="meta-comments"><i class="x-icon-comments"></i> %3$s</a></span>',
              esc_url( $link ),
              esc_attr( sprintf( __( 'Leave a comment on: &ldquo;%s&rdquo;', '__x__' ), $title ) ),
              $number . ' ' . __( 'Comment' , '__x__' )
            );
          } else {
            $comments = sprintf( '<span><a href="%1$s" title="%2$s" class="meta-comments"><i class="x-icon-comments"></i> %3$s</a></span>',
              esc_url( $link ),
              esc_attr( sprintf( __( 'Leave a comment on: &ldquo;%s&rdquo;', '__x__' ), $title ) ),
              $number . ' ' . __( 'Comments' , '__x__' )
            );
          }
        } else {
          $comments = '';
        }
    
        $post_type           = get_post_type();
        $post_type_post      = $post_type == 'post';
        $post_type_portfolio = $post_type == 'x-portfolio';
        $no_post_meta        = x_get_option( 'x_blog_enable_post_meta' ) == 0;
        $no_portfolio_meta   = x_get_option( 'x_portfolio_enable_post_meta' ) == 0;
    
        if ( $post_type_post && $no_post_meta || $post_type_portfolio && $no_portfolio_meta ) {
          return;
        } else {
          printf( '<p class="p-meta">%1$s%2$s%3$s%4$s</p>',
            $author,
            $date,
            $categories_list,
            $comments
          );
        }
    
      }

    It’ll remove date stamp from your site, so Google won’t crawl the dates in future. Please wait at least 72hrs to see the effect on search results.

    Hope this helps, Cheers!

    #82409

    AJ M
    Participant

    Thanks,

    I suppose I don’t mind doing it with a child theme… but isn’t there a way to do it with the parent?

    I ask as we don’t actually intend on updating anything now that the site is finished and dialed in (unless we absolutely have to e.g. a security hole or similar).

    Further, I don’t really mind having to re-add the above code should something happen such that we have to update the theme.

    Let me know, if you would,
    AJ

    #82460

    Nabeel A
    Moderator

    Hey Aj,

    You can add the above code directly to parent theme’s functions.php file. Path is /x/functions.php

    Let us know how this goes!

    #87088

    AJ M
    Participant

    Hi,

    This isn’t working either, unfortunately. Google has crawled the site each day since the code was implemented and is still showing the date in Search. Also, the code is adding the post’s date at the bottom-left of the footer on the front end (via document.write).

    Any other suggestions?

    AJ

    #87334

    Paul R
    Moderator

    Hi Aj,

    Try to edit the file x/framework/functions/integrity.php directly

    Then remove this code

    
    $date = sprintf( '<span><time class="entry-date" datetime="%1$s"><i class="x-icon-calendar"></i> %2$s</time></span>',
          esc_attr( get_the_date( 'c' ) ),
          esc_html( get_the_date() )
        );
    

    Line number 27-30

    Let us know how it goes.

    Thanks

    #98242

    Lars W
    Participant

    Would you mind consider adding this as a setting instead pls? It’s not very SEO friendly to show dates on pages and portfolios.

    #98248

    Christopher
    Moderator

    Thank you for your feature request.
    We let our developers to know about it.

    #109766

    Jen H
    Participant

    +1 for removing date from Google results

    #109769

    Cousett
    Member

    Thank you for your input we will let our developers know.

    #110110

    Mark K
    Participant

    Date Exclusion SEO Plugin is working now, FYI.

    #110208

    Nabeel A
    Moderator

    Nice to hear that Mark!

    #114210

    skmarc
    Participant

    Hi,

    Please make this as a feature in future updates, or has this been done already?

    #114325

    Rad
    Moderator

    Hi there,

    Google author meta was removed, but not sure with date. I’m not sure if it will be implemented or not, date is one of blogging default feature.

    But, I’ll forward your request 🙂

    You can find something like this from x/framework/functions/{YOUR CHOSEN STACK}.php

    $date = sprintf( '<span><time class="entry-date" datetime="%1$s"><i class="x-icon-calendar"></i> %2$s</time></span>',
          esc_attr( get_the_date( 'c' ) ),
          esc_html( get_the_date() )
        );

    And change to

    $date = '';

    Cheers!