I want to put the variable in the shortcode, but it is not working. What i have done wrong.

<?php $calendar = getCalendarTag();?>
<?php echo do_shortcode( '[ai1ec tag_name=".$calendar."]"]' ) ?>    
  • 1
    Your shortcode is mssing quotes before the . and you also have an extra ]. It should be '[ai1ec tag_name="' . $calendar . '"]'; – czerspalace Sep 3 '15 at 16:57

Try changing your code to:

<?php echo do_shortcode('[ai1ec tag_name="' . $calendar . '"]'); ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.