Organized Docs WordPress Plugin

Check if current page is an Organized Docs page

This custom function will determine if you’re on an Organized Docs page. It will return TRUE if you’re on any of the single Docs pages, or on a Docs category or Docs taxonomy page.

/**
 * Determine if the current page belongs to the Organized Docs plugin.
 *
 * @return bool 	Returns TRUE on single docs, docs category, and docs taxonomy pages, otherwise return FALSE.
 */
function is_organized_docs_page() {
	if ( is_tax( 'isa_docs_category' ) || is_post_type_archive( 'isa_docs' ) || is_singular( 'isa_docs' ) ) {
		return true;
	} else {
		return false;
	}
}

After you’ve added the function above, you can use it like this:

To check if you’re on an Organized Docs page, use it like this:

// Check if you're on an Organized Docs page: 

if ( is_organized_docs_page() ) {

	// Yes, this is an Organized Docs page

}

To check if you’re on any page that’s NOT an Organized Docs page, use it like this:

// Check if you're on any page that's NOT an Organized Docs page

if ( ! is_organized_docs_page() ) {

	// This iS NOT an Organized Docs page

}

Updated on March 31, 2016

Questions and Comments are Welcome

Your email address will not be published. All comments will be moderated.

Please wrap code in "code" bracket tags like this:

[code]

YOUR CODE HERE 

[/code]