0

Sorry if I worded the question wrong. In the code below, is there a way to insert php where the date is?

So this:

<?php echo do_shortcode('[fergcorp_cdt_single date="08 December 2013"]') ?>

Would become something like this:

<?php echo do_shortcode('[fergcorp_cdt_single date="<?=$date?>"]') ?>

Is the above correct? If not, how would I write it?

2 Answers 2

2
<?php echo do_shortcode('[fergcorp_cdt_single date="' . $date . '"]'); ?>
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you so much! I will check your answer in a few minutes.
1

You could also use double quotes:

<?php echo do_shortcode("[fergcorp_cdt_single date=\"$date\"]") ?>

1 Comment

Yes, but why make the code wilfully less readable? You'll have to escape the double quotes in the string and are hiding $date from most syntax highlighters.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.