How To Program Your Copyright Symbol


We’ve been hard at work developing a Shopify integration for a client that’s quite robust and complex… more to come on that when we publish it. With all the development we’re doing, I was embarrassed when I was testing their site to see the copyright notice in the footer was out of date… showing last year instead of this year. It was a simple oversight as we had coded a text input field to display and just hard-coded the year in there to get them live.

Ecommerce Marketing Automation

Shopify Template: Publish Copyright Symbol and Current Year With Liquid

Today, I updated the theme Shopify template to automatically keep the copyright year up to date and append the appropriate text from the text field. The solution was this little snippet of liquid script:

©{{ "now" | date: "%Y" }} DK New Media, LLC. All Rights Reserved

Here’s the breakdown:

  • The ampersand and copy; is called an HTML entity and is the appropriate method to display the copyright symbol © for all browsers to display it correctly.
  • The liquid snippet uses “now” to get the server’s current date and the element date: “%Y” formats the date as a 4-digit year.

WordPress Theme: Publish Copyright Symbol and Current Year With PHP

If you’re using WordPress, the solution is just a PHP snippet:

&copy;<?php echo date("Y"); ?> DK New Media, LLC. All Rights Reserved
  • The ampersand and copy; is called an HTML entity and is the appropriate method to display the copyright symbol © for all browsers to display it correctly.
  • The PHP snippet uses “date” to get the server’s current date and the element date: “Y” formats the date as a 4-digit year.
  • We just added our business and All Rights Reserved rather than programming a setting in our theme… of course, you could do that as well.

Programmatically Publish Copyright Symbol and Current Year in ASP

<% response.write ("&copy;" & Year(Now)) %> DK New Media, LLC. All Rights Reserved

Programmatically Publish Copyright Symbol and Current Year in .NET

<%="&copy;" & DateTime.Now.Year %> DK New Media, LLC. All Rights Reserved

Programmatically Publish Copyright Symbol and Current Year in Ruby

&copy;<%= Time.now.year %> DK New Media, LLC. All Rights Reserved

Programmatically Publish Copyright Symbol and Current Year in JavaScript

&copy; <script>document.write(new Date().getFullYear());</script> DK New Media, LLC. All Rights Reserved

Programmatically Publish Copyright Symbol and Current Year in Django

&copy; {% now "Y" %} DK New Media, LLC. All Rights Reserved

Programmatically Publish Copyright Symbol and Current Year in Python

from datetime import date
todays_date = date.today()
print("&copy;", todays_date.year)
print(" DK New Media, LLC. All Rights Reserved")

Programmatically Publish Copyright Symbol and Current Year in AMPscript

If you’re using Marketing Cloud, you can use this method in your email templates.

&copy; %%xtyear%% DK New Media, LLC. All Rights Reserved

Regardless of your app, content management system, e-commerce, or email platform, I’d encourage you to always programmatically update your copyright year. And of course, if you need some help on this – feel free to reach out to my firm Highbridge. We don’t do one-off small projects but can implement this as part of a larger project you might have.



Source link

30%* off! Big Savings For Your Small Business!

LEAVE A REPLY

Please enter your comment!
Please enter your name here