slug] = $result->name;
}
endif;
return $results;
}
endif;
function awe_blog_sanitize_image($image, $setting)
{
$type = [
'jpg|jpeg|jpe' => 'image/jpeg',
'gif' => 'image/gif',
'png' => 'image/png',
'bmp' => 'image/bmp',
'tif|tiff' => 'image/tiff',
'ico' => 'image/x-icon',
];
$file = wp_check_filetype($image, $type);
return $file['ext'] ? $image : $setting->default;
}
function awe_blog_sanitize_url($url)
{
return esc_url_raw($url);
}
function awe_blog_sanitize_select($input, $setting)
{
$input = sanitize_key($input);
$choices = $setting->manager->get_control($setting->id)->choices;
return array_key_exists($input, $choices) ? $input : $setting->default;
}
/**
* Class to create a custom post control
*/
class awe_blog_Post_Dropdown_Custom_Control extends WP_Customize_Control
{
public $type = 'select';
public function __construct($manager, $id, $args = [], $options = [])
{
$postargs = wp_parse_args($options, ['numberposts' => '-1']);
$this->posts = get_posts($postargs);
parent::__construct($manager, $id, $args);
}
/**
* Render the content on the theme customizer page
*/
public function render_content()
{
if (!empty($this->posts)) { ?>
slug] = $postresult->name;
}
endif;
return $postresults;
}
endif;