Using the Current Year in Your Posts – WordPress

You are here: Home » Blog » CMS » WordPress » Using the Current Year in Your Posts – WordPress

Using the Current Year in Your Posts – WordPress

Using the Current Year in Your Posts – WordPress: Do you ever wish you could insert the current year in some of your posts via a simple shortcode?

Add the snippet below to your functions.php file and you’ll be partying like it’s [year]. Obviously we dont use the [year] shortcode on this site because its displaying the shortcode [year] and not the actual current year. 🙂

function year_shortcode() {
$year = date('Y');
return $year;
}
add_shortcode('year', 'year_shortcode');

Related Links:

Show Popular Posts Without Plugins

What is a Shortcode in WordPress?

WordPress by the Numbers Facts

How to Update: Automatically create media_buttons for shortcode selection

Should I Choose a Hosted or Non-hosted Blogging Platform?

What is a Blog?

Create a PayPal Donation Shortcode – WordPress

Redirect New Registered Users to a Specific Page – WordPress

FAQ Hacked WordPress Website

The background-color CSS property

How do I start a WordPress blog? (hosting wordpress)

How do I install plugins in WordPress?

WordPress, SEO, and Social Media Marketing

WordPress Posts vs Pages

Introduction to Python Programming Language

Change the Author Permalink Structure – WordPress

Choose your preferred blog CMS platform

Why Python is the cooler programming language

Comparing Python to other languages

Helping humans speak to the computer

The Python Standard Library Ver 3.6.5

Learn more about JavaScript Variables

Learn Code Introspection Python Programming

Learn about programming Loops in Python

Learn Partial functions Python programming

Tips and Tricks for WRITING JAVASCRIPT code

Learn about programming Functions in Python

Learn about Numpy Arrays in Python programming

CODING WITH CSS: The style attribute

Learn about Python Generators

Learn about programming Classes and Objects in Python

Python String Formatting

Introduction to JavaScript – Variables: String Interpolation

Learn List Comprehensions in Python Programming

Learn about Python Conditions

Methods of teaching programming

 

By |2019-02-08T19:25:30-04:00March 19th, 2018|Categories: CMS, WordPress|Tags: , , , , |

About the Author:

I am a loving father, & husband. I am a computer enthusiast. I have used and enjoyed computers since I was young and I enjoy teaching young minds how to code, because it teaches them how to think. Today with YouTube, and social media garbage our youth are losing the ability to think on their own and solve problems. I believe this is a serious epidemic as kids today dont understand that technology is a tool. This tool is being abused, and its underlying effects are taking its toll on kids behaviour, and learning.