我自定义一个wordpress插件并放置html代码。当我尝试运行它时,我的PHP代码工作正常但我的html没有显示。
我尝试将html代码作为
Okay I am you the whole function.
if($ special_dates){
// Variables
$get_title = get_the_title($post->ID);
$count = 1;
foreach ((array) $special_dates as $key => $special_date) {
if (isset($special_date['date_date'])) {
$s_date = strtotime($special_date['date_date']);
$currentDate = date("Y-m-d");
$current = strtotime($currentDate);
if ($current > $s_date) {
continue;
}
}
if ($count == 1) {
$title = '<h1 class="location-name" itemprop="name">Holiday Hours</h1>';
echo $title;
echo '<ul class="location-hours">';
}
$count++;
$sd_desc = $sd_date = $sd_open_bool = $sd_open_time = $sd_close_time = '';
if (isset($special_date['date_closing_time'])) {
$sd_close_time = $special_date['date_closing_time'];
}
if (isset($special_date['date_desc'])) {
$sd_desc = $special_date['date_desc'];
}
if (isset($special_date['date_date'])) {
$sd_date = date_i18n(get_option('date_format'), strtotime($special_date['date_date']));
}
if (isset($special_date['date_open_bool'])) {
$sd_open_bool = $special_date['date_open_bool'];
}
if (isset($special_date['date_opening_time'])) {
$sd_open_time = $special_date['date_opening_time'];
}
// if(date_i18n(get_option('date_format'),strtotime($ special_date ['date_date']))&gt; = date(get_option('date_format'))){ 如果(1){ ?&GT;
<div class="date-time">
-
<?php
if ($sd_open_bool) {
echo date($time_format, strtotime($sd_open_time));
echo ' - ';
echo date($time_format, strtotime($sd_close_time));
} else {
echo '<span class="closed">';
echo __('Closed', 'coh');
echo '</span>';
}
?>
<?php if ($sd_desc) { ?>
<span class="date-desc">- <?php echo $sd_desc; ?></span>
<?php } ?>
</div>
</li>
<?php } ?>
<?php
}
echo '</ul>';
}
但是这个HTML代码无效。
此致