Eliot, I do have another query relating to the code above (but not related to the original scenario behind this post), I guess i’m potentially de-railing the thread, but maybe not, I’m wondering if you would know how to handle/code the following:
Let me explain, to execute a [shortcode] in php, i believe it can be done like so:
<?php
echo do_shortcode(‘[shortcode]optional parameters[/shortcode]’);
?>
So, in my case would look to pass an optional date parameter to my shortcode, like so:
<?php
echo do_shortcode(‘[myShortcode timetext=”2014-12-31″] Will be the expiry date![/myShortcode]’);
?>
>> 2014-12-31 Will be the expiry date!
(i know, the logic is not totally correct because is not an output, is simply to demonstrate that the parameter needs to take a date in that format)
So, I been trying without success to pass the date value held in the variable to a shortcode, but cannot get it to work, do you happen to know how could i pass the value held in my variable to a shortcode? using the example code above do you happen to know how can i replace the shortcode date parameter with the actual variable?
I was thinking something alone the following lines:
<?php
$expiryDATE = get_post_meta(get_the_ID(), “clpr_expire_date”, true);
echo ‘Expiry date : ‘.$expiryDATE;
echo do_shortcode(‘[myShortcode timetext=”.$expiryDATE.”] Will be the expiry date![/myShortcode]’);
?>
My expected output then would be something along the following lines:
Expiry date : 2014-12-31 Will be the expiry date!
But the date value inside the shortcode seems to always be just zeros: 0000:00:00
Do you have any precise tips as to how i may be able to resolve this?
If you could crack this code I will share with you the cool end result which i’m miserably trying to implement.
Thank you