Add Meta Description Tags to Archive Pages in WordPress

/ Published in: PHP
Save to your folder(s)

The php if statement below checks to see if the content is an archive page. If it is, then it echoes the html structure for meta description tags and also includes the month and year to avoid content duplication.

Copy this code and paste it in your HTML
  1. <?php if (is_month()) {echo '<meta name="description" content="'; the_time('F, Y'); echo ' archive page for Electric Mohawk."/>';}?>


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.