'type', 'type' => 'select', 'label' => __('Date', 'zadex'), 'default' => 'published', 'options' => [ ['value' => 'published', 'label' => __('Published', 'zadex')], ['value' => 'modified', 'label' => __('Last modified', 'zadex')], ]], ['id' => 'format', 'type' => 'text', 'label' => __('Format', 'zadex'), 'default' => '', 'placeholder' => 'F j, Y', 'description' => __('PHP date format. Empty uses the site setting.', 'zadex')], ]; } public function render(array $settings, Context $ctx) { if ($ctx->post_id <= 0) { return ''; } $format = isset($settings['format']) && is_string($settings['format']) ? trim($settings['format']) : ''; if (($settings['type'] ?? 'published') === 'modified') { return (string) get_the_modified_date($format, $ctx->post_id); } return (string) get_the_date($format, $ctx->post_id); } }