2921 | | $has_audio = $wpdb->get_var( " |
2922 | | SELECT ID |
2923 | | FROM $wpdb->posts |
2924 | | WHERE post_type = 'attachment' |
2925 | | AND post_mime_type LIKE 'audio%' |
2926 | | LIMIT 1 |
2927 | | " ); |
2928 | | $has_video = $wpdb->get_var( " |
2929 | | SELECT ID |
2930 | | FROM $wpdb->posts |
2931 | | WHERE post_type = 'attachment' |
2932 | | AND post_mime_type LIKE 'video%' |
2933 | | LIMIT 1 |
2934 | | " ); |
| 2921 | if ( false === ( $has_audio = get_transient( 'has_audio' ) ) ) { |
| 2922 | $has_audio = $wpdb->get_var( " |
| 2923 | SELECT ID |
| 2924 | FROM $wpdb->posts |
| 2925 | WHERE post_type = 'attachment' |
| 2926 | AND post_mime_type LIKE 'audio%' |
| 2927 | LIMIT 1 |
| 2928 | " ); |
| 2929 | $has_audio = $has_audio ? 1 : 0; |
| 2930 | set_transient( 'has_audio', $has_audio ); |
| 2931 | } |
| 2932 | if ( false === ( $has_video = get_transient( 'has_video' ) ) ) { |
| 2933 | $has_video = $wpdb->get_var( " |
| 2934 | SELECT ID |
| 2935 | FROM $wpdb->posts |
| 2936 | WHERE post_type = 'attachment' |
| 2937 | AND post_mime_type LIKE 'video%' |
| 2938 | LIMIT 1 |
| 2939 | " ); |
| 2940 | $has_video = $has_video ? 1 : 0; |
| 2941 | set_transient( 'has_video', $has_video ); |
| 2942 | } |