Avada Forums Community Forum Automatically display current year in footer: Original Code

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • useral
    Participant
    Post count: 2

    Dear All,

    I am writing with a quick question concerning the copyright notice in the footer of my Avada syte.
    I remember that, after installing Avada, the copyright notice in my footer displayed the current year automatically. However, I think I deleted that code (if I am using the word “code” correctly, since only implied using predetermined options).

    I found some “JavaScript Snippets” and “PHP Snippets” (http://updateyourfooter.com/), but I am not sure if any of those should be applied.

    If anyone knows what the original code actually is, I would very much appreciate your help!

    With kind regards,
    Al

    pigsandbees
    Participant
    Post count: 29

    Paste the code below into Avada > Theme Options > Footer Content > Copyright Text:

    <script>document.write(new Date().getFullYear())</script>

    useral
    Participant
    Post count: 2

    Thanks for your reply, @pigsandbees !

    So, should we assume that JavaScript snippets can be used in this part (as well as possibly in some other parts) of our Avada site?

    Thanks again!

    TheDigitalMoose
    Participant
    Post count: 12

    @useral – I keep this website in my bookmarks –

    http://updateyourfooter.com/

    Very useful to have on hand.

    Javascript snippets – yes. I’ve only ever used simple one’s like this, so not sure if using anything more complicated would affect Avada scripts.

    madbirdesign
    Participant
    Post count: 8

    Using this code creates an error message in the Chrome console: [Violation] Avoid using document.write(). https://developers.google.com/web/updates/2016/08/removing-document-write
    (anonymous) @ (index):222

    Is there a way to get the current year in the copyright notice without <script>document.write?

    danjo007
    Participant
    Post count: 2

    https://www.wpbeginner.com/wp-tutorials/how-to-display-todays-date-in-wordpress/

    This is how to add the year (or complete current date) without any errors in the footer via shortcode. You add the code to your Avada child theme functions.php and then add the shortcode anywhere on your site to display the date.

    stphnwlkr
    Participant
    Post count: 64

    I just create a shortcode [copyright] and drop it in the footer

    function addCopyright() {
    $year = date_i18n ('Y');
    return 'Unless otherwise noted &copy;' . $year . ' <a href="">My Name</a>. All Rights Reserved.' ;
    }
    add_shortcode ('copyright', 'addCopyright');
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.