I have a function that outputs HTML and in that list of $output statements I need to output the code which already resides in a shortcode for use elsewhere.

$output = 'shortcode here';

I attempted the do_shortcode() avenue only to get the WSOD :)

What would be the proper way to declare the shortcode in such a statement?

  • You've tried do_shortcode( '[shortcode_here]' ); and it fails? Does the shortcode work properly when added to the content as normal? – Howdy_McGee Dec 15 '16 at 20:26
  • I think the single quotes around the shortcode may be where I failed. I will retry. Thanks! – James Dec 15 '16 at 21:50
  • That should be $output .= do_shortcode ('[shortcode here]'); Correct? – James Dec 15 '16 at 21:52

Your Answer

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

Browse other questions tagged or ask your own question.