我有一个wordpress主题,我想在首页显示某个促销开始时间。它使用jquery。倒计时。min.js并具有以下默认计时器设置
var siteCountDown = function() {
if ( $(\'#date-countdown\').length > 0 ) {
$(\'#date-countdown\').countdown(\'2020/10/10\', function(event) {
var $this = $(this).html(event.strftime(\'\'
+ \'<span class="countdown-block"><span class="label">%w</span> weeks </span>\'
+ \'<span class="countdown-block"><span class="label">%d</span> days </span>\'
+ \'<span class="countdown-block"><span class="label">%H</span> hr </span>\'
+ \'<span class="countdown-block"><span class="label">%M</span> min </span>\'
+ \'<span class="countdown-block"><span class="label">%S</span> sec</span>\'));
});
}
};
siteCountDown();
它显示,促销活动将在四个月后开始。但我想通过wordpress管理仪表板手动设置计时器。是否可以在中插入一些php代码
.countdown(\'2020/10/10\' 类似于
<?php if ($year = get_option(\'of_year\') && $month = get_option(\'of_month\') && $day = get_option(\'of_day\') ) { ?>
.countdown(\'<?php echo $year; ?>/<?php echo $month; ?>/<?php echo $day; ?>
<?php } ?>
这样我就可以手动编辑促销开始时间
我的选择是:
$options[] = array( "name" => "Year",
"desc" => "promo start year",
"id" => $shortname."_promo_year",
"std" => "",
"type" => "text");
$options[] = array( "name" => "Mount",
"desc" => "promo start month",
"id" => $shortname."_promo_month",
"std" => "",
"type" => "text");
$options[] = array( "name" => "Day",
"desc" => "promo start day",
"id" => $shortname."_promo_day",
"std" => "",
"type" => "text");