add custom shortcode
-
I would like to add a custom shortcode to my page, using Elementor Pro. My goal is to echo the current day + 2 days. It should look like this:
‘I will contact you before [today +2]. So if today is Thursday, it will look like this:
‘I will contact you before Saturday’.In my functions.php I added these lines:
add_filter( ‘elementor_pro/dynamic_tags/shortcode/should_escape’, ‘__return_false’ );
function year_shortcode() {
$n = date(‘Y-m-d’, strtotime( $d . ” +2 days”));
return $n;
}
add_shortcode(‘year’, ‘year_shortcode’);On my page I added a dynamic shortcode like this: [year_shortcode] but nothing happens.
How do I have to implement this?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘add custom shortcode’ is closed to new replies.