Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 3 down vote accepted
<?php echo do_shortcode("[apply]<a href='" . site_url() . "/quick-quote'>Quick Quote</a>[/apply]"); ?> 
share|improve this answer
    
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 –  m0r7if3r Feb 17 '12 at 2:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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