• Adding self-updating copyright text to your footers

    This is another quick and easy PHP function you can use to automatically update your copyright statement at the bottom of your web pages.

    As always, I recommend that you have a functions.php file that you include at the top of each of your pages, which then makes it easy to pull through features like this one.

    1
    2
    3
    4
    5
    function getCopyright() {
      $thisYear=date('Y'); // GETS CURRENT YEAR
      $copyright="Copyright <a href=\"http://www.frecosse.com\">Frecosse Website Design</a>, $thisYear.  All rights reserved.";
      return $copyright;
    }

    This then allows you to quickly call it into the HTML of your page with:

    1
    2
    3
    <div id="footer">
    <? echo getCopyright(); ?>
    </div>

    The advantage of using a function like this, is that it means a) the year is always correct, and b) if you should need to change your business name, or add more details, you simply update the function, and not every single page.

    Share and Enjoy:
    • Digg
    • Sphinn
    • del.icio.us
    • Facebook
    • Mixx
    • Google Bookmarks

     Leave a reply