I would like to use custom shortcodes in Yoast SEO Plugin, but I can't bring it to work. I want to put custom time specifications in the meta title.
This is my shortcode:
function time_yoast_shortcode() {
$year = date('Y');
return $year;
}
add_shortcode('yyyy', 'time_yoast_shortcode')
This is how I want the title in the Yoast to look like: THIS IS MY EXAMPLE POST in the year [yyyy]
Any ideas how I can make my shortcode work in Yoast?
If you'd like your post to show the date at the end of your SEO Title of Yoast try: %%date%% within the SEO Title field of the yoast plugin on that particular post. For just the year use %%currentyear%%.
In the event you'd like to do this globally you can do this within the post titles & metas section of the plugin settings.
Here is a full list of their varables