@@ 3449-3470 (lines=22) @@ | ||
3446 | * @param mixed $attachment Attachment ID, title, slug, or array of such. |
|
3447 | * @return bool |
|
3448 | */ |
|
3449 | public function is_attachment( $attachment = '' ) { |
|
3450 | if ( ! $this->is_attachment ) { |
|
3451 | return false; |
|
3452 | } |
|
3453 | ||
3454 | if ( empty( $attachment ) ) { |
|
3455 | return true; |
|
3456 | } |
|
3457 | ||
3458 | $attachment = array_map( 'strval', (array) $attachment ); |
|
3459 | ||
3460 | $post_obj = $this->get_queried_object(); |
|
3461 | ||
3462 | if ( in_array( (string) $post_obj->ID, $attachment ) ) { |
|
3463 | return true; |
|
3464 | } elseif ( in_array( $post_obj->post_title, $attachment ) ) { |
|
3465 | return true; |
|
3466 | } elseif ( in_array( $post_obj->post_name, $attachment ) ) { |
|
3467 | return true; |
|
3468 | } |
|
3469 | return false; |
|
3470 | } |
|
3471 | ||
3472 | /** |
|
3473 | * Is the query for an existing author archive page? |
|
@@ 3483-3502 (lines=20) @@ | ||
3480 | * @param mixed $author Optional. User ID, nickname, nicename, or array of User IDs, nicknames, and nicenames |
|
3481 | * @return bool |
|
3482 | */ |
|
3483 | public function is_author( $author = '' ) { |
|
3484 | if ( !$this->is_author ) |
|
3485 | return false; |
|
3486 | ||
3487 | if ( empty($author) ) |
|
3488 | return true; |
|
3489 | ||
3490 | $author_obj = $this->get_queried_object(); |
|
3491 | ||
3492 | $author = array_map( 'strval', (array) $author ); |
|
3493 | ||
3494 | if ( in_array( (string) $author_obj->ID, $author ) ) |
|
3495 | return true; |
|
3496 | elseif ( in_array( $author_obj->nickname, $author ) ) |
|
3497 | return true; |
|
3498 | elseif ( in_array( $author_obj->user_nicename, $author ) ) |
|
3499 | return true; |
|
3500 | ||
3501 | return false; |
|
3502 | } |
|
3503 | ||
3504 | /** |
|
3505 | * Is the query for an existing category archive page? |
|
@@ 3515-3534 (lines=20) @@ | ||
3512 | * @param mixed $category Optional. Category ID, name, slug, or array of Category IDs, names, and slugs. |
|
3513 | * @return bool |
|
3514 | */ |
|
3515 | public function is_category( $category = '' ) { |
|
3516 | if ( !$this->is_category ) |
|
3517 | return false; |
|
3518 | ||
3519 | if ( empty($category) ) |
|
3520 | return true; |
|
3521 | ||
3522 | $cat_obj = $this->get_queried_object(); |
|
3523 | ||
3524 | $category = array_map( 'strval', (array) $category ); |
|
3525 | ||
3526 | if ( in_array( (string) $cat_obj->term_id, $category ) ) |
|
3527 | return true; |
|
3528 | elseif ( in_array( $cat_obj->name, $category ) ) |
|
3529 | return true; |
|
3530 | elseif ( in_array( $cat_obj->slug, $category ) ) |
|
3531 | return true; |
|
3532 | ||
3533 | return false; |
|
3534 | } |
|
3535 | ||
3536 | /** |
|
3537 | * Is the query for an existing tag archive page? |
|
@@ 3547-3566 (lines=20) @@ | ||
3544 | * @param mixed $tag Optional. Tag ID, name, slug, or array of Tag IDs, names, and slugs. |
|
3545 | * @return bool |
|
3546 | */ |
|
3547 | public function is_tag( $tag = '' ) { |
|
3548 | if ( ! $this->is_tag ) |
|
3549 | return false; |
|
3550 | ||
3551 | if ( empty( $tag ) ) |
|
3552 | return true; |
|
3553 | ||
3554 | $tag_obj = $this->get_queried_object(); |
|
3555 | ||
3556 | $tag = array_map( 'strval', (array) $tag ); |
|
3557 | ||
3558 | if ( in_array( (string) $tag_obj->term_id, $tag ) ) |
|
3559 | return true; |
|
3560 | elseif ( in_array( $tag_obj->name, $tag ) ) |
|
3561 | return true; |
|
3562 | elseif ( in_array( $tag_obj->slug, $tag ) ) |
|
3563 | return true; |
|
3564 | ||
3565 | return false; |
|
3566 | } |
|
3567 | ||
3568 | /** |
|
3569 | * Is the query for an existing custom taxonomy archive page? |