Advertisement
Guest User

Untitled

a guest
Jul 7th, 2014
360
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function get_image_sizes( $size = '' ) {
  2.     global $_wp_additional_image_sizes;
  3.     $sizes = array();
  4.     $get_intermediate_image_sizes = get_intermediate_image_sizes();
  5.     foreach( $get_intermediate_image_sizes as $_size ) {
  6.         if ( in_array( $_size, array( 'thumbnail', 'medium', 'large' ) ) ) {
  7.             $sizes[ $_size ]['width'] = (int) get_option( $_size . '_size_w' );
  8.             $sizes[ $_size ]['height'] = (int) get_option( $_size . '_size_h' );
  9.             $sizes[ $_size ]['crop'] = (bool) get_option( $_size . '_crop' );
  10.         } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
  11.             $sizes[ $_size ] = array( 'width' => $_wp_additional_image_sizes[ $_size ]['width'],
  12.                           'height' => $_wp_additional_image_sizes[ $_size ]['height'],
  13.                           'crop' =>  $_wp_additional_image_sizes[ $_size ]['crop'] );
  14.         }
  15.     }
  16.     if ( $size ) {
  17.         if( isset( $sizes[ $size ] ) ) {
  18.             return $sizes[ $size ];
  19.         } else {
  20.             return false;
  21.         }
  22.     }
  23.     return $sizes;
  24. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement