クラス WP_Query::is_attachment()
2014/12/16
WP_Query::is_attachment()
定義ファイル :/blog/wp-includes/query.php 8
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | public function is_attachment( $attachment = '' ) { if ( ! $this->is_attachment ) { return false; } if ( empty( $attachment ) ) { return true; } $attachment = (array) $attachment; $post_obj = $this->get_queried_object(); if ( in_array( $post_obj->ID, $attachment ) ) { return true; } elseif ( in_array( $post_obj->post_title, $attachment ) ) { return true; } elseif ( in_array( $post_obj->post_name, $attachment ) ) { return true; } return false; } |