Quintic
WordPress Cheat-Sheet

Page or Post

is_page() // Returns true if a page
is_single() // Returns true if a single post
is_singular() // Returns true if any type of single item (Post, Page, Attachment, Custom post) 

Post / Page with given Caterogy

$categories = get_the_category();
  if ( ! empty( $categories ) ) 
  {
	foreach ( (array) $categories as $category ) 
	{
	  $peers = get_posts(array('category' => $category,
				  'exclude' => $post->id));

Leave a Reply