Is there a better way to output HTML as a shortcode?
Shortcodes should always return data rather than echoing it. That way it appears in the right place on the page. A couple of ways you can do this: Option 1 – add to variable function my_output() { $output=”<div>” . $myvariable . ‘</div>’; return $output; } Option 2 – use the object buffer function my_output() { … Read more