Sitemap
Deepak Jerry

Deepak Jerry

Wordpress Developer At Ifrita Web solution

How Make Shortcode in WordPress

Sep 1, 2022

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.

--

--

Deepak Jerry
Deepak Jerry

Written by Deepak Jerry

Wordpress Developer At Ifrita Web solution