Skip to content

Instantly share code, notes, and snippets.

@vfontjr
Created May 4, 2020 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vfontjr/7231ae402d43575c28ed6ea6c3726a0e to your computer and use it in GitHub Desktop.
Save vfontjr/7231ae402d43575c28ed6ea6c3726a0e to your computer and use it in GitHub Desktop.
<?php
add_image_size( string $name, int $width, int $height, bool|array $crop = false );
<?php
//* Add new image sizes
add_image_size( 'front-page-icon', 90, 90, false );
function post_image_sizes($sizes){
$custom_sizes = array(
'front-page-icon' => 'Front Page'
);
return array_merge( $sizes, $custom_sizes );
}
add_filter('image_size_names_choose', 'post_image_sizes');
<?php
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment