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.

1 Answer 1

<?php echo do_shortcode("[apply]<a href='" . site_url() . "/quick-quote'>Quick Quote</a>[/apply]"); ?> 
  • perfect. thanks! am I concatenating because it's already in php?
    – chris_s
    Feb 16, 2012 at 20:19
  • @chris_s bingo. You might actually want to use site_url( '/quick-quote/' ); instead...it's a bit neater
    – mor7ifer
    Feb 17, 2012 at 2:36

Your Answer

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

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