icon-picker
8 years ago
menu-item-custom-fields
8 years ago
compat.php
8 years ago
form-fields.php
8 years ago
functions.php
8 years ago
compat.php
24 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Misc. functions for backward-compatibility. |
| 5 | */ |
| 6 | |
| 7 | if ( ! function_exists( 'wp_get_attachment_image_url' ) ) { |
| 8 | /** |
| 9 | * Get the URL of an image attachment. |
| 10 | * |
| 11 | * @since 4.4.0 |
| 12 | * |
| 13 | * @param int $attachment_id Image attachment ID. |
| 14 | * @param string|array $size Optional. Image size to retrieve. Accepts any valid image size, or an array |
| 15 | * of width and height values in pixels (in that order). Default 'thumbnail'. |
| 16 | * @param bool $icon Optional. Whether the image should be treated as an icon. Default false. |
| 17 | * @return string|false Attachment URL or false if no image is available. |
| 18 | */ |
| 19 | function wp_get_attachment_image_url( $attachment_id, $size = 'thumbnail', $icon = false ) { |
| 20 | $image = wp_get_attachment_image_src( $attachment_id, $size, $icon ); |
| 21 | return isset( $image['0'] ) ? $image['0'] : false; |
| 22 | } |
| 23 | } |
| 24 |