For my wordpress website I am trying to remove the Google timestamp that is currently in my SERP (search page result description.)
To do this I must use javascript to get the time and report it back.
You may want to refer to this link: http://www.andrewkeir.com/remove-wordpress-post-datestamp-timestamp-google-serps/
and to another question here: Need to insert javascript into php code [Wordpress Website]
The code in my template file is:
$out .= '<div class="info"><a class="date-left"></a><a href="'.get_month_link($year, $month).'" class="date">'.get_the_time('F j, Y').'</a><a class="date-right"></a>
and I need to get this code to work in its place:
<script language="javascript" type="text/javascript">document.write("<?php the_time('F jS, Y') ?>");</script>
Appreciate any help/guidance on how to do this.
Basically that first article you referenced is telling you that you need to wrap the code that determines the time using PHP (in your case the “get_the_time(‘F j, Y’)” part) with Javascript that will write the exact same output to the document. Therefore if you take your existing code:
You’ll probably want to do something like this: