Take the 2-minute tour ×

I hope someone can help me with this. The code below is from a WordPress Plugin. From the plugin option page I am entering some simple html -

<h3>Showname</h3><p>with DJ Top</p>

The code below ($showname) is used (a WordPress shortcode) to display what I've entered, but it actually displays the HTML rather than processing it i.e displaying the HTML header and paragraph.

Can anyone point me in the direction so $showname processes the HTML rather than just printing it out verbatim tags and all.

Many thanks


function showtime_schedule_handler($atts, $content=null, $code=""){

global $wpdb;
global $showtimeTable;

//Get the current schedule, divided into days

$schedule = array();

$output = '';

foreach ($daysOfTheWeek as $day) {
    //Add this day's shows HTML to the $output array
    $showsForThisDay =  $wpdb->get_results( $wpdb->prepare ( "SELECT * FROM $showtimeTable WHERE dayOfTheWeek = '$day' ORDER BY startTime" ));

    //Check to make sure this day has shows before saving the header
    if ($showsForThisDay){
        $output .= '<h2>'.$day.'</h2>';
        $output .= '<ul class="showtime-schedule">';
        foreach ($showsForThisDay as $show){
            $showName = $show->showName;
            $startClock = $show->startClock;
            $endClock = $show->endClock;
            $linkURL = $show->linkURL;

            if ($linkURL){
                $showName = '<a href="'.$linkURL.'">'.$showName.'</a>';
            $output .= '<li><strong>'.$startClock.'</strong> - <strong>'.$endClock.'</strong>: '.$showName.'</li>';

        $output .= '</ul>';
return $output;
share|improve this question
This is just a guess, but I might try return html_entity_decode($output);. –  Jason Swett Oct 22 '12 at 21:08
Many thanks Jason, worked perfectly! Many thanks. –  Rob Oliver Oct 22 '12 at 21:15

2 Answers 2

You're outputting with a variant of the text/plain MIME type. You'll need to send it out with a default header (text/html) in order for the browser to parse it properly.

For instance:

    header('Content-Type: text/html', true);
    echo showtime_schedule_handler($atts, $content);
share|improve this answer
The code in my question is part of a WordPress plugin, in particular a function and having tried it doesn't seem to work as is. Would it not have more todo with htmlentities (possibly?). –  Rob Oliver Oct 22 '12 at 21:13

Instead of

return $output;


return html_entity_decode($output);
share|improve this answer

Your Answer


