0
$dt = date_default_timezone_set('America/New_York');
$dt = date("h:i:s");
$x = date('d-m-Y');
$d = $dt;
//echo $x." ".$d;
echo do_shortcode('[tminus t= "10-10-2015 00:00:00"]');
//echo do_shortcode('[tminus t= "'.$x.'""00:00:00"]');

I have used $x variable inside shortcode but my site goes blank, due to syntax error I know it. But how can I call variable in this shortcode please any one can tell me?

Schwern
  • 153,029
  • 25
  • 195
  • 336
Joy Rocky
  • 9
  • 5
  • Possible duplicate of [How to combine two strings together?](http://stackoverflow.com/questions/8336858/how-to-combine-two-strings-together) – rnevius Oct 08 '15 at 20:03

1 Answers1

0

you could use string substitution with "..$x.." or concatenate the strings

Concatenation:

echo do_shortcode('[tminus t= "' . $x . ' 00:00:00"]');

Substitution (vars will be expanded):

echo do_shortcode("[tminus t= \"$x 00:00:00\"]");

for more details, you should have a look at http://www.php.net/manual/en/language.types.string.php

Philipp
  • 15,377
  • 4
  • 35
  • 52