Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #226676

    cpjennmeakin
    Participant

    I would like to add a copyright with the current year in my footer. Within the wordpress files, I know that I can add <?php echo date(‘Y’); ?> and it will show the current year. However, is there a way to add this in the footer text from within the “Customise” section of the CMS?

    Here is where I would like to add this info
    https://www.dropbox.com/s/99myfcrpwfcv8si/currentyear.png?dl=0

    #226892

    Darshana
    Moderator

    Hi there,

    Thanks for writing in! You can use the following code in your footer content:

    
    <p>Copyright <span id="year">TEXT</span> Company Name - All Rights Reserved.</p>
    

    And then, add the following code into your Customizer, Custom > JavaScript section.

    
    jQuery(document).ready(function() {
      var currentYear = (new Date).getFullYear();
      jQuery("#year").text( (new Date).getFullYear() );
    });
     
    

    Hope that helps.

    #228625

    cpjennmeakin
    Participant

    worked perfectly – thanks!

    #228706

    Nico
    Moderator

    You’re most welcome! Let us know if you need anything else.

    Cheers!

    #641339

    WPH2o
    Participant

    This gave me the footer but instead of the date it showed “TEXT.”

    Then I added <script> tags </script> around the jquery code and it worked.

    #641370

    Thai
    Moderator

    Glad it worked @wph2o 🙂

    #789593

    fullframenw
    Participant

    When you say “add code in your footer content” do you mean paste this code into the custom css area? And if not, where can I paste this code? It doesn’t seem to work when I paste in the custom css area.

    #790242

    Friech
    Moderator

    Hi There,

    No, those codes are not custom css. On the Customizer navigate to Footer panel and look for the Footer Content fields and paste the code below:

    <p>Copyright <span id="year">TEXT</span> Company Name - All Rights Reserved.</p>


    screenshot

    Notice this string <span id="year">TEXT</span> that string will be replace with a current year (2016) on the front end. To achieve that you need to add this under Custom > JavaScript in the Customizer’s Custom panel.

    jQuery(document).ready(function() {
      var currentYear = (new Date).getFullYear();
      jQuery("span#year").text( (new Date).getFullYear() );
    });

    Hope it helps, Cheers!