Keeping your site’s copyright date current shows visitors that your content is up to date. Instead of manually editing the footer each year, you can configure WordPress to update the copyright date automatically. On ruachost.com, this is done with a simple PHP snippet.

 

Why Automate the Copyright Date?

  • Avoids forgetting to update the year manually.

  • Ensures your site always looks fresh and maintained.

  • Saves time for administrators managing multiple sites.

 

Steps to Implement Automatic Copyright Date

  1. Log in to WordPress with an administrator account.

  2. In the dashboard, go to Appearance → Theme Editor.

  3. Select your active theme and open the functions.php file.

  4. Add the following code snippet:

    // Function to display automatic copyright date
    function copyright($start_year, $site_name) {
        $year = date('Y');
        echo "© Copyright ";
        echo $start_year;
        if ($start_year != $year) {
            echo "-$year";
        }
        echo ", $site_name. All Rights Reserved.";
    }
    
     
  5. Save the file.

 

Adding the Copyright to Footer

  1. In the Theme Editor, open footer.php.

  2. Insert the following code where you want the copyright text to appear:

    <div class="copyright">
        <?php copyright(2021, "Your Site Name"); ?>
    </div>
    
    • Replace 2021 with the year your site started.

    • Replace "Your Site Name" with your actual site name.

  3. Save changes.

✅ Your footer will now automatically update the copyright year each January.

 

Important Notes

  • Always back up your theme before editing functions.php or footer.php.

  • Use a child theme to preserve changes during updates.

  • This method only updates the year; the start year must be hardcoded.

 
Bu cevap yeterince yardımcı oldu mu? 0 Bu dökümanı faydalı bulan kullanıcılar: (0 Oy)

Powered by WHMCompleteSolution