-
AuthorPosts
-
March 13, 2015 at 11:05 am #226676
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=0March 13, 2015 at 5:23 pm #226892Hi 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.
March 16, 2015 at 4:00 pm #228625worked perfectly – thanks!
March 16, 2015 at 5:50 pm #228706You’re most welcome! Let us know if you need anything else.
Cheers!
October 27, 2015 at 6:27 am #641339This 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.
October 27, 2015 at 6:55 am #641370February 10, 2016 at 1:35 pm #789593When 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.
February 10, 2016 at 10:03 pm #790242Hi 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>
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!
-
AuthorPosts