0

誰かがこれで私を助けてくれることを願っています。以下のコードは、WordPress プラグインからのものです。プラグイン オプション ページから、簡単な html を入力しています -

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

以下のコード ($showname) は、入力した内容を表示するために使用されます (WordPress ショートコード) が、実際には HTML を処理するのではなく、つまり HTML ヘッダーと段落を表示して表示します。

$showname が HTML を逐語的なタグやすべてを出力するのではなく処理するように、誰かが私に方向を示すことができますか?

どうもありがとう

ロブ

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

global $wpdb;
global $showtimeTable;

//Get the current schedule, divided into days
$daysOfTheWeek = array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");

$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;
}
4

2 に答える 2

1

text/plainMIME タイプのバリアントで出力しています。text/htmlブラウザが正しく解析するには、デフォルトのヘッダー ( ) を付けて送信する必要があります。

例えば:

<?php
    header('Content-Type: text/html', true);
    echo showtime_schedule_handler($atts, $content);
?>
于 2012-10-22T21:07:01.017 に答える
0

それ以外の

return $output;

試す

return html_entity_decode($output);
于 2012-10-23T01:43:22.540 に答える