Skip to main content

Emdedding Embedding PHP in shortcode $content

Source Link
chris_s
  • 319
  • 1
  • 4
  • 16

Emdedding PHP in shortcode $content

I have created an enclosing shortcode that is styled to be a button with the intention of putting content in it. I am echoing this shortcode inside a theme file and want the content to link to a specific relative page. However, I am not using the proper quotations and can't seem to figure this rudimentary php syntax out.

<?php echo do_shortcode('[apply]<a href="<?php echo site_url(); ?>/quick-quote">Quick Quote</a>[/apply]'); ?> 

I know this is wrong. Just looking for some guidance.