/** * Post Types checkboxes * * @param array $instance Widget values. * @param object $widget Widget. */ function widget_form_fields_post_types($instance, $widget) { global $wpgeo; if ($widget == $this) { $options = get_option('wp_geo_options'); echo '<p><strong>' . esc_html__('Show Post Types', 'wp-geo') . ':</strong></p>'; $post_types = get_post_types(array(), 'objects'); $custom_post_type_checkboxes = ''; foreach ($post_types as $post_type) { if ($wpgeo->post_type_supports($post_type->name)) { $checked = in_array($post_type->name, $instance['post_type']) ? $post_type->name : false; $custom_post_type_checkboxes .= wpgeo_checkbox($this->get_field_name('post_type') . '[]', $post_type->name, $checked) . ' ' . $post_type->label . '<br />'; } } echo $custom_post_type_checkboxes; } }
/** * Feeds Field */ function feeds_field() { global $wpgeo; $options = get_option('wp_geo_options'); echo '<label>' . wpgeo_checkbox('wp_geo_options[add_geo_information_to_rss]', 'Y', $options['add_geo_information_to_rss'], false, 'add_geo_information_to_rss') . ' ' . esc_html__('Add geographic information', 'wp-geo') . '</label>'; }
/** * Options Checkbox HTML * * @todo Deprecate this function. * * @param string $id Field ID. * @param string $val Field value. * @param string $checked Checked value. * @param bool $disabled (optional) Is disabled? * @return string Checkbox HTML. */ function options_checkbox($name, $val, $checked, $disabled = false, $id = '') { return wpgeo_checkbox($name, $val, $checked, $disabled, $id); }