Tagged: Shortcodes
I’m wondering if there are shortcodes built in for dates such as [the-year] and [the-month] etc.
Please let me know, and if not, my alternatives.
Hey dmoravec!
Please add following code to Functions.php file in Appearance > Editor for year
function year_shortcode() {
$year = date('Y');
return $year;
}
add_shortcode('year', 'year_shortcode');
and for month
function month_shortcode() {
$month = date('M');
return $month;
}
add_shortcode('month', 'month_shortcode');
Best regards,
Yigit
Does this need to be done every time that I do a theme update? Is there a method that would surpass having to redo this every time I update the theme?
Hey!
Thank you for coming back.
When you are using a child theme, put the code in functions.php of the child theme. This file is not changed when updating the parent theme.
When using a only the parent theme, then you can only use a workaround.
Put the code in a seperate php file, lets say my_file.php and copy this in the folder enfold\config-templatebuilder\avia-shortcodes\.
It will then be loaded automatically with the ALB files.
Just make sure, that you copy this file after every theme update.
Regards,
Günter