関数 get_uploaded_header_images()
2014/12/17
関数 get_uploaded_header_images()
定義ファイル : /blog/wp-includes/theme.php 3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | function get_uploaded_header_images() { $header_images = array(); // @todo caching $headers = get_posts( array( 'post_type' => 'attachment', 'meta_key' => '_wp_attachment_is_custom_header', 'meta_value' => get_option('stylesheet'), 'orderby' => 'none', 'nopaging' => true ) ); if ( empty( $headers ) ) return array(); foreach ( (array) $headers as $header ) { $url = esc_url_raw( wp_get_attachment_url( $header->ID ) ); $header_data = wp_get_attachment_metadata( $header->ID ); $header_index = basename($url); $header_images[$header_index] = array(); $header_images[$header_index]['attachment_id'] = $header->ID; $header_images[$header_index]['url'] = $url; $header_images[$header_index]['thumbnail_url'] = $url; if ( isset( $header_data['width'] ) ) $header_images[$header_index]['width'] = $header_data['width']; if ( isset( $header_data['height'] ) ) $header_images[$header_index]['height'] = $header_data['height']; } return $header_images; } |