• I want to hide the date in my Google snippet and I currently use Yoast SEO plugin. I couldn’t change there so I thought I could change it myself. I notice you have the ‘the_date’ function in 9 matches across 7 files. However, I thought I can use Javascript instead of PHP.

    <?php the_time(‘F jS, Y’) ?>
    I can replace with,

    <script language=”javascript”
    type=”text/javascript”>document.write(“<?php the_time(‘F jS, Y’)
    ?>”);</script>

    Google does not use javascript when pulling data for the description. So it will display for the user but not read by Google.

    I could do these in the free themes but am unable to find the required function. I am not sure what to replace with what.

    In my files, I can only see,

    C:\wamp\www\wp-content\themes\TheDefensionem\cover.php:
    52 // Day
    53 if( is_day() ){
    54: $title = get_the_date();
    55 $title_above = __(‘Daily Archives’, ‘brook’);
    56 }
    ..
    58 // Month
    59 if( is_month() ){
    60: $title = get_the_date( _x( ‘F Y’, ‘monthly archives date format’, ‘brook’ ) );
    61 $title_above = __(‘Monthly Archives’, ‘brook’);
    62 }
    ..
    64 // Year
    65 if( is_year() ){
    66: $title = get_the_date( _x( ‘Y’, ‘yearly archives date format’, ‘brook’ ) );
    67 $title_above = __(‘Yearly Archives’, ‘brook’);
    68 }

    C:\wamp\www\wp-content\themes\TheDefensionem\infobar.php:
    29 <div class=”meta–items fl”>
    30 <div class=”meta–item meta–date”>
    31: <?php echo get_the_date(); ?>
    32 </div>
    33 </div>

    C:\wamp\www\wp-content\themes\TheDefensionem\loop_item-grid_gallery.php:
    84 <div class=”meta–items”>
    85 <div class=”meta–item meta–date”>
    86: <?php echo get_the_date(); ?>
    87 </div>
    88

    C:\wamp\www\wp-content\themes\TheDefensionem\loop_item-list_archive.php:
    66
    67 <div class=”meta–item meta–date”>
    68: <?php echo get_the_date(); ?>
    69 </div>
    70

    C:\wamp\www\wp-content\themes\TheDefensionem\loop_item-widget_list.php:
    19
    20 <div class=”meta–item meta–date”>
    21: <?php echo get_the_date(); ?>
    22 </div>
    23

    C:\wamp\www\wp-content\themes\TheDefensionem\post_meta.php:
    2
    3 <div class=”meta–item meta–date”>
    4: <?php echo get_the_date(); ?>
    5 </div>
    6

    C:\wamp\www\wp-content\themes\TheDefensionem\related_posts.php:
    59
    60 <div class=”meta–item meta–date”>
    61: <?php echo get_the_date(); ?>
    62 </div>
    63

    9 matches across 7 files

    I could do these in the free themes but am unable to find the required function. I am not sure what to replace with what.

The topic ‘Hide date in Google snippet using PHP.’ is closed to new replies.