# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: \trunk\wp-includes
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
|
|
|
175 | 175 | * @since 2.0.0 |
176 | 176 | * @uses $wp_query |
177 | 177 | * |
| 178 | * @param mixed $attachment Attachment ID, title, slug, or array of such. |
178 | 179 | * @return bool |
179 | 180 | */ |
180 | | function is_attachment() { |
| 181 | function is_attachment( $attachment = '' ) { |
181 | 182 | global $wp_query; |
182 | 183 | |
183 | 184 | if ( ! isset( $wp_query ) ) { |
… |
… |
|
185 | 186 | return false; |
186 | 187 | } |
187 | 188 | |
188 | | return $wp_query->is_attachment(); |
| 189 | return $wp_query->is_attachment( $attachment ); |
189 | 190 | } |
190 | 191 | |
191 | 192 | /** |
… |
… |
|
3108 | 3109 | * |
3109 | 3110 | * @since 3.1.0 |
3110 | 3111 | * |
| 3112 | * @param mixed $attachment Attachment ID, title, slug, or array of such. |
3111 | 3113 | * @return bool |
3112 | 3114 | */ |
3113 | | function is_attachment() { |
3114 | | return (bool) $this->is_attachment; |
| 3115 | function is_attachment( $attachment = '' ) { |
| 3116 | if ( !$this->is_attachment ) |
| 3117 | return false; |
| 3118 | |
| 3119 | if ( empty( $attachment ) ) |
| 3120 | return true; |
| 3121 | |
| 3122 | $attachment = (array) $attachment; |
| 3123 | |
| 3124 | $post_obj = $this->get_queried_object(); |
| 3125 | |
| 3126 | if ( in_array( $post_obj->ID, $attachment ) ) |
| 3127 | return true; |
| 3128 | elseif ( in_array( $post_obj->post_title, $attachment ) ) |
| 3129 | return true; |
| 3130 | elseif ( in_array( $post_obj->post_name, $attachment ) ) |
| 3131 | return true; |
| 3132 | |
| 3133 | return false; |
3115 | 3134 | } |
3116 | 3135 | |
3117 | 3136 | /** |