| @@ -129,11 +129,11 @@ | ||
| 129 | 129 | |
| 130 | 130 | if ( is_string( $args['size'] ) ) { |
| 131 | 131 | list( $args['thumb_width'], $args['thumb_height'] ) = self::get_thumb_size( $args['size'] ); |
| 132 | 132 | } else { |
| 133 | - $args['thumb_width'] = $args['size'][0]; | |
| 134 | - $args['thumb_height'] = $args['size'][1]; | |
| 135 | - $args['size'] = self::get_appropriate_image_size( $args['size'][0], $args['size'][1] ); | |
| 133 | + $args['thumb_width'] = absint( $args['size'][0] ); | |
| 134 | + $args['thumb_height'] = absint( $args['size'][1] ); | |
| 135 | + $args['size'] = self::get_appropriate_image_size( $args['thumb_width'], $args['thumb_height'] ); | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | $post_title = esc_attr( $result->post_title ); |
| 139 | 139 | |
| @@ -965,12 +965,24 @@ | ||
| 965 | 965 | ); |
| 966 | 966 | |
| 967 | 967 | $args = wp_parse_args( $args, $default_args ); |
| 968 | 968 | |
| 969 | + $thumb_width = absint( $args['thumb_width'] ); | |
| 970 | + $thumb_height = absint( $args['thumb_height'] ); | |
| 971 | + | |
| 969 | 972 | if ( 'css' === $args['thumb_html'] ) { |
| 970 | - $thumb_html = ' style="max-width:' . $args['thumb_width'] . 'px;max-height:' . $args['thumb_height'] . 'px;" '; | |
| 973 | + $styles = array(); | |
| 974 | + if ( $thumb_width ) { | |
| 975 | + $styles[] = 'max-width:' . $thumb_width . 'px'; | |
| 976 | + } | |
| 977 | + if ( $thumb_height ) { | |
| 978 | + $styles[] = 'max-height:' . $thumb_height . 'px'; | |
| 979 | + } | |
| 980 | + $thumb_html = $styles ? ' style="' . implode( ';', $styles ) . ';" ' : ''; | |
| 971 | 981 | } elseif ( 'html' === $args['thumb_html'] ) { |
| 972 | - $thumb_html = ' width="' . $args['thumb_width'] . '" height="' . $args['thumb_height'] . '" '; | |
| 982 | + $thumb_html = $thumb_width ? ' width="' . $thumb_width . '"' : ''; | |
| 983 | + $thumb_html .= $thumb_height ? ' height="' . $thumb_height . '"' : ''; | |
| 984 | + $thumb_html = $thumb_html ? $thumb_html . ' ' : ''; | |
| 973 | 985 | } else { |
| 974 | 986 | $thumb_html = ''; |
| 975 | 987 | } |
| 976 | 988 | |