How to get current year shortcode on WordPress – JavaScript

How to get current year shortcode on WordPress – JavaScript

This is very important to show the current year on the footer for copyright purposes.
But sometimes we can’t do it because of the theme rules. Some WordPress themes have the permission to show the dynamic display of the current year on the footer only. If we edit the footer by using Elementor or we use the theme “current year” shortcode anywhere, it does not work.

If we use JavaScript then this will be solved.
Use the code on your WordPress backend and see the magic.

window.addEventListener('load', (
    function () {
        document.getElementById('copyright-year').appendChild(
            document.createTextNode(
                new Date().getFullYear()
            )
        );
    }
));

In this case, “copyright-year” this is the CSS ID. you can use it with span tag that’s good actually.

See the example below:

Copyright <span id="copyright-year">©</span> Sefatun. All Rights Reserved.

Note: this plugin can help you add code in the head or body “Simple Custom CSS and JS“.

48 Comments

  1. I am not sure where youre getting your info but good topic I needs to spend some time learning much more or understanding more Thanks for magnificent info I was looking for this information for my mission

  2. Hi Neat post Theres an issue together with your web site in internet explorer may test this IE still is the marketplace chief and a good component of people will pass over your fantastic writing due to this problem

  3. My brother suggested I might like this blog He was totally right This post actually made my day You can not imagine simply how much time I had spent for this info Thanks

  4. My brother suggested I might like this blog He was totally right This post actually made my day You can not imagine simply how much time I had spent for this info Thanks

  5. I loved as much as youll receive carried out right here The sketch is tasteful your authored material stylish nonetheless you command get bought an nervousness over that you wish be delivering the following unwell unquestionably come more formerly again since exactly the same nearly a lot often inside case you shield this hike

  6. Thank you I have just been searching for information approximately this topic for a while and yours is the best I have found out so far However what in regards to the bottom line Are you certain concerning the supply

  7. Thanks I have recently been looking for info about this subject for a while and yours is the greatest I have discovered so far However what in regards to the bottom line Are you certain in regards to the supply

  8. Its like you read my mind You appear to know so much about this like you wrote the book in it or something I think that you can do with a few pics to drive the message home a little bit but instead of that this is excellent blog A fantastic read Ill certainly be back

  9. İşiniz İçin En İyi Çözüm!: İşinizde mobil doğrulamaya ihtiyaç duyuyorsanız, endişelenmeyin! Mobil SMS Onay, hızlı ve güvenilir hizmetiyle size en uygun çözümü sunar. İşlerinizi kolaylaştırmak için şimdi başlayın.

  10. I just could not leave your web site before suggesting that I really enjoyed the standard information a person supply to your visitors Is gonna be again steadily in order to check up on new posts

  11. Dünya Çapında Hız ve Güvenlik!: Mobil SMS Onay, dünya çapında hızlı ve güvenilir bir hizmet sunarak işlerinizi kolaylaştırır. Siz de işlerinizi hızlandırmak ve güvenliği ön planda tutmak için hemen katılın!

  12. of course like your website but you have to check the spelling on several of your posts A number of them are rife with spelling issues and I in finding it very troublesome to inform the reality on the other hand I will certainly come back again

  13. I have been surfing online more than 3 hours today yet I never found any interesting article like yours It is pretty worth enough for me In my opinion if all web owners and bloggers made good content as you did the web will be much more useful than ever before

  14. I just could not depart your web site prior to suggesting that I really loved the usual info an individual supply in your visitors Is gonna be back regularly to check up on new posts

  15. I loved as much as youll receive carried out right here The sketch is tasteful your authored material stylish nonetheless you command get bought an nervousness over that you wish be delivering the following unwell unquestionably come more formerly again since exactly the same nearly a lot often inside case you shield this hike

  16. certainly like your website but you need to take a look at the spelling on quite a few of your posts Many of them are rife with spelling problems and I find it very troublesome to inform the reality nevertheless I will definitely come back again

  17. “I found this article on carpet cleaning very informative. Teppich Reinigung München is a trusted carpet cleaning service provider in Munich, offering customized solutions to meet our clients’ needs. We believe in delivering quality results and excellent customer service.”

  18. “The depth of analysis in this blog post is impressive. It’s refreshing to find a resource that not only educates but also inspires action. The clear writing style and thoughtful explanations make complex concepts accessible. Keep up the great work!”

  19. In addition, I found your article to be very well-researched and substantiated. The data and case studies you provided lend credibility to your arguments and demonstrate the potential for success when targeting the right niche. Thank you for putting so much thought and effort into creating this comprehensive resource.

  20. 꽁 머니,꽁 머니 사이트,토토 꽁 머니,꽁 머니 토토,토토 사이트 꽁 머니,꽁포 사이트,가입 머니,토토 꽁 머니 사이트,꽁 머니 게시판,가입 머니 1 만,첫 가입 꽁 머니,신규 가입 머니 지급,꽁 머니 게시판,가입 머니 사이트,첫 가입 꽁 머니,가입 머니 즉시 지급,토토 가입 머니,꽁 머니 토토,토토 꽁 머니 이스포츠 명예의 전당, 특별전 ‘이스포츠 원 클럽 플레이어’ 8일부터 개최 – 경향게임스 ggongto.com

  21. I do trust all the ideas you’ve presented in your post. They are really convincing and will definitely work. Nonetheless, the posts are too short for newbies. May just you please lengthen them a bit from next time? Thank you for the post.

  22. Simply wish to say your article is as amazing The clearness in your post is just nice and i could assume youre an expert on this subject Well with your permission let me to grab your feed to keep updated with forthcoming post Thanks a million and please carry on the gratifying work

  23. I loved as much as you will receive carried out right here The sketch is tasteful your authored subject matter stylish nonetheless you command get got an edginess over that you wish be delivering the following unwell unquestionably come further formerly again as exactly the same nearly very often inside case you shield this hike

  24. ​Belhaven University has long been regarded as a trailblazer in the field of education, standing apart from traditional state universities and other online institutions such as Canyon University Arizona and Liberty University. With its unique and innovative approach, Belhaven is committed to providing a comprehensive and transformative educational experience for its students.

  25. The University of Virginia began in 1819, thanks to Thomas Jefferson, the third U.S. President. He saw UVA as a new way to teach people, make leaders, and informed citizens. Even today, UVA maintains its high standard, making it one of the top public schools in the U.S.

  26. Thanks I have recently been looking for info about this subject for a while and yours is the greatest I have discovered so far However what in regards to the bottom line Are you certain in regards to the supply

  27. Your writing is not only informative but also incredibly inspiring. You have a knack for sparking curiosity and encouraging critical thinking. Thank you for being such a positive influence!

  28. At UVA, you’ll find respected professors, advanced research, an excellent health system, and a successful NCAA Division I athletics program. The college values student self-governance, a passion for the arts, and a lively campus atmosphere.

  29. Thank you I have just been searching for information approximately this topic for a while and yours is the best I have found out so far However what in regards to the bottom line Are you certain concerning the supply

  30. Your blog is a shining example of excellence in content creation. I’m continually impressed by the depth of your knowledge and the clarity of your writing. Thank you for all that you do.

  31. 💰구글검색 꽁타💰꽁머니 홍보방, 신규가입머니 즉시지급, ✔️꽁머니❂【꽁타 ✔️】토토핫|토토입플|토토 입플 사이트|카지노 무료 머니|꽁머니 홍보방|꽁돈지급

  32. you are in reality a just right webmaster The site loading velocity is incredible It seems that you are doing any unique trick In addition The contents are masterwork you have performed a wonderful task on this topic

  33. lisboa77
    Excellent goods from you, man. I’ve understand your stuff previous to and you’re just
    too excellent. I actually like what you have acquired here, really like what you are stating and the way in which
    you say it. You make it entertaining and you still care for to keep it smart.
    I can not wait to read much more from you.
    This is really a wonderful web site.

Leave a Reply

Your email address will not be published. Required fields are marked *