i want to output html tags in do_shortcode(); function

<?php echo do_shortcode($content); ?>

is it possible? thx!

2 Answers
2

Yes it is possible.

There are two ways that I can think of at this moment.

First follow what the codex says Shortcodes.
Basically you just wrap your html in ob_start(); this will return the html as a string so you can echo it.

function my_shortcode() {
    ob_start();
    ?> <HTML> <here> ... <?php
    return ob_get_clean();
}

The second way is to add your html as a string to a variable then return it later. eg.

function my_shortcode() {
    $output="";
    $output.= '<html>content</html>';
    return $output;
}

Leave a Reply

Your email address will not be published. Required fields are marked *