How Make Shortcode in WordPress
Today will learn how to make wordpress shortcode and print the shortcode and will print simple year using shortcode.
First of all make a function in my case i’ll make “date_jerry_function”.
<?php
Get Deepak Jerry’s stories in your inbox
Join Medium for free to get updates from this writer.
function date_jerry_function() {
$year = date(‘Y’);
return $year;
}
add_shortcode(‘year’, ‘date_jerry_function’);
Note: this code paste in your themes functions.php
Now we will echo this shortcode in any pages
<?php echo do_shortcode(“[year]”);?>
That’s all thank you.








