This function will find the earliest post or page on your site, compare its year to the current year, and output the correct range of years for your footer copyright statement.
- Copy the PHP code into your theme's
functions.php
- In your theme's
footer.php
use the function<?php copyright_years(); ?>
where you want the years to appear
<div class="site-footer">
<p class="copyright">© <?php copyright_years(); ?>. All Rights Reserved.</p>
</div>