kompass/components/partials/date-element.php
2024-03-23 20:46:44 +01:00

25 lines
780 B
PHP

<?php
function _kompass_print_datebox($settingName, $settingValue, $style = '') {
echo '<input style="' . $style . '" type="date" name="' . $settingName . '" value="' . $settingValue. '" />';
if (defined('WP_DEBUG') && WP_DEBUG == true) {
echo '<br />' . $settingName;
}
}
function kompass_print_datebox(array $args) {
if (!isset($args['setting'])) {
wp_die('Missing argument setting at text-element ' . print_r($args, true));
}
$setting = get_option($args['setting'], null);
$setting = $setting ?? ( $args['value'] ?? '' );
$style = isset($args['style']) ? $args['style'] : '';
$value = esc_attr($setting);
if ($value === null && isset($args['value'])) {
$value = $args['value'];
}
_kompass_print_datebox($args['setting'], $value, $style);
}