0

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.

4
<?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 '12 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 '12 at 2:36

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.