public function is_new() { $options = WNG::get_option(); if (isset($options['wng_latest_new']) && self::$number == 0) { return true; } $term = $options['wng_newmark']; if (!isset($term) || $term == 0) { return false; } $today = date_i18n('U'); $post_date = date('U', strtotime($this->raw_date)); $diff = ($today - $post_date) / (24 * 60 * 60); if ($term > $diff) { return true; } return false; }
function setting_dateformat() { $options = WNG::get_option(); $items = array("Y年n月j日", "Y-m-d", "Y/m/d", "j/n/Y", "n/j/Y"); echo "<select id='wng_dateformat' name='whats_new_options[wng_dateformat]'>"; foreach ($items as $item) { $selected = $options['wng_dateformat'] == $item ? 'selected="selected"' : ''; echo "<option value='{$item}' {$selected}>{$item}</option>"; } echo "</select>"; }