I'm trying to put the Date Published and Date Modified into the meta tags of the head of the header.php page - so far no luck.
This is what I currently have:
<meta name="date" content="<?php echo get_the_date( 'm-d-Y' ); ?>">
<meta name="revised" content="<?php echo the_modified_date( 'm-d-Y' ); ?>">
I've also left off the get_ with the_date but that didn't work either. I've tried the_date. I've tried without the echo.
I assume that since the header.php is pulled on each post and page, and that these dates are pulled in the Admin area that these should already in the Loop without needing to add to the functions.php. If I do need to add this can someone assist me with the code to put into the file and which file?
When I do an analysis at http://analyzer.metatags.org/ the page shows:
Status: 200 OK
Last update: Thu, 01 Jan 1970 00
Web Server: Apache
Content Type: text/html; charset=UTF-8
I really don't want to use a plugin. I'd rather learn how to do it.
I understand how to put this into a post or page but I can't get it right in the header.php.