<?php | |
// test images | |
add_image_size( 'ducks', 350, 350, true ); | |
add_image_size( 'cows', 750, 150, true ); | |
//this function does not work and acts very wacky | |
function add_image_check(){ | |
global $_wp_additional_image_sizes; | |
//default array | |
$default = array( | |
'thumbnail' => __('Thumbnail'), | |
'medium' => __('Medium'), | |
'large' => __('Large'), | |
'full' => __('Full Size') | |
); | |
//array from add_image_size | |
$new = $_wp_additional_image_sizes; | |
//merge the arrays | |
$result = array_merge($default, array_keys($new)); | |
return $result; | |
}; | |
add_filter('image_size_names_choose', 'add_image_check' ); | |
//######################################################### | |
//this function works | |
function add_image_check_part2(){ | |
global $_wp_additional_image_sizes; | |
//default array with hardcoded values fro add_image_size | |
$default = array( | |
'thumbnail' => __('Thumbnail'), | |
'medium' => __('Medium'), | |
'large' => __('Large'), | |
'full' => __('Full Size'), | |
'ducks' => __('Ducks'), | |
'cows' => __('Cows') | |
); | |
return $default | |
}; | |
add_filter('image_size_names_choose', 'add_image_check_part2' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment