| 1 | 170a171,194 |
|---|
| 2 | > |
|---|
| 3 | > /** |
|---|
| 4 | > * Is the query for an existing post format archive page? |
|---|
| 5 | > * |
|---|
| 6 | > * @see WP_Query::is_post_format_archive() |
|---|
| 7 | > * @since 3.8.2 |
|---|
| 8 | > * @uses $wp_query |
|---|
| 9 | > * |
|---|
| 10 | > * @param mixed $post_formats Optional. Post format or array of posts formats to check against. |
|---|
| 11 | > * @return bool |
|---|
| 12 | > */ |
|---|
| 13 | > function is_post_format_archive( $post_formats = '' ) { |
|---|
| 14 | > global $wp_query; |
|---|
| 15 | > |
|---|
| 16 | > if ( ! isset( $wp_query ) ) { |
|---|
| 17 | > _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); |
|---|
| 18 | > return false; |
|---|
| 19 | > } |
|---|
| 20 | > |
|---|
| 21 | > return $wp_query->is_post_format_archive( $post_formats ); |
|---|
| 22 | > } |
|---|
| 23 | > |
|---|
| 24 | > |
|---|
| 25 | > |
|---|
| 26 | 1269a1294,1302 |
|---|
| 27 | > * Set if query is for a post format archive. |
|---|
| 28 | > * |
|---|
| 29 | > * @since 3.8.2 |
|---|
| 30 | > * @access public |
|---|
| 31 | > * @var bool |
|---|
| 32 | > */ |
|---|
| 33 | > var $is_post_format_archive = false; |
|---|
| 34 | > |
|---|
| 35 | > /** |
|---|
| 36 | 1339a1373 |
|---|
| 37 | > $this->is_post_format_archive = false; |
|---|
| 38 | 1614c1648,1653 |
|---|
| 39 | < if ( $this->is_post_type_archive || $this->is_date || $this->is_author || $this->is_category || $this->is_tag || $this->is_tax ) |
|---|
| 40 | --- |
|---|
| 41 | > if ( !empty( $qv['post_format'] ) && ! is_array( $qv['post_format'] ) ) { |
|---|
| 42 | > $this->is_post_format_archive = true; |
|---|
| 43 | > } |
|---|
| 44 | > |
|---|
| 45 | > |
|---|
| 46 | > if ( $this->is_post_type_archive || $this->is_date || $this->is_author || $this->is_category || $this->is_tag || $this->is_tax || $this->is_post_format_archive ) |
|---|
| 47 | 3386a3426,3445 |
|---|
| 48 | > * Is the query for an existing post format archive page? |
|---|
| 49 | > * |
|---|
| 50 | > * @since 3.8.2 |
|---|
| 51 | > * |
|---|
| 52 | > * @param mixed $post_formats Optional. Post format or array of post formats to check against. |
|---|
| 53 | > * @return bool |
|---|
| 54 | > */ |
|---|
| 55 | > function is_post_format_archive( $post_formats = '' ) { |
|---|
| 56 | > |
|---|
| 57 | > if ( empty( $post_formats ) || ! $this->is_post_format_archive ) |
|---|
| 58 | > return (bool) $this->is_post_format_archive; |
|---|
| 59 | > |
|---|
| 60 | > $post_format = $this->get( 'post_format' ); |
|---|
| 61 | > $post_format = str_replace( 'post-format-', '', $post_format ); |
|---|
| 62 | > |
|---|
| 63 | > return in_array( $post_format, (array) $post_formats ); |
|---|
| 64 | > } |
|---|
| 65 | > |
|---|
| 66 | > |
|---|
| 67 | > /** |
|---|