WPDIR
Everything and everyone WordPress

How to detect WordPress single post and blog post type only?

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #603 Reply
    Samuel
    Guest

    I found this fantastic snippet from Nilay:

    // Run code only for Single post page
    if ( is_single() && 'post' == get_post_type() ) {
      
    }
    
    //if it's not a specific post-type
    if ( is_single() && 'portfolio' != get_post_type() ) {
      
    }
    #604 Reply
    Christian
    Guest
    #631 Reply
    Eugene
    Guest

    Very useful

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: How to detect WordPress single post and blog post type only?