is_page

Definition:
function is_page( $page = '' ) {}

Is the query for a single page?
If the $page parameter is specified, this function will additionally check if the query is for one of the pages specified.

Parameters

  • mixed $page: Page ID, title, slug, or array of such.

Source code

	function is_page( $page = '' ) {

		if ( !$this->is_page )

			return false;



		if ( empty( $page ) )

			return true;



		$page_obj = $this->get_queried_object();



		$page = (array) $page;



		if ( in_array( $page_obj->ID, $page ) )

			return true;

		elseif ( in_array( $page_obj->post_title, $page ) )

			return true;

		else if ( in_array( $page_obj->post_name, $page ) )

			return true;



		return false;

	}

2153

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: