| 295 | * Is the query for a post format archive page? |
| 296 | * |
| 297 | * If the $format parameter is specified, this function will check |
| 298 | * if the query is for one of the formats. |
| 299 | * specified. |
| 300 | * |
| 301 | * @since 3.9.0 |
| 302 | * @uses $wp_query |
| 303 | * |
| 304 | * @param mixed $format Optional. Format slug or array of format slugs, without the post-format prefix. |
| 305 | * @return bool |
| 306 | */ |
| 307 | function is_post_format_archive( $format = '' ) { |
| 308 | global $wp_query; |
| 309 | |
| 310 | if ( ! isset( $wp_query ) ) { |
| 311 | _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); |
| 312 | return false; |
| 313 | } |
| 314 | |
| 315 | if ( ! empty( $format ) ) { |
| 316 | if ( is_array( $format ) ) { |
| 317 | foreach ( $format as &$value ) { |
| 318 | $value = 'post-format-' . $value; |
| 319 | } |
| 320 | } else { |
| 321 | $format = 'post-format-' . $format; |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | return $wp_query->is_tax( 'post_format', $format ); |
| 326 | } |
| 327 | |
| 328 | /** |