You can combine conditions:
if ( ! empty ( $GLOBALS['post'] )
&& is_single()
&& in_category( 'gaming', $GLOBALS['post'] )
)
{
// do something
}
See PHP manual: Logical Operators and Exclude custom function content from certain pages.
Related Posts:
- How do test if a post is a custom post type?
- Display several random posts, but make sure a condition is met
- Exclude custom function content from certain pages
- Newer/Older posts links display same posts on every page
- How do I write this SQL statement for Posts written in last 24 hours?
- How to show related posts by category or custom post type?
- How to create posts (not post template) to be displayed on projects page?
- IF statement in a do_shortcode
- Why does using WP_Query inside a shortcode in an elementor page cause the arguments for WP_Query to get malformed?
- get_template_part for custom post type content not working
- Loop on front-page.php
- How to get all posts except for one post from a certain custom post type?
- Need help targeting a custom post type with conditional tags
- Can I create a loop with multiple post types and specify different $args for each post type?
- How i can add ‘N’ page of ‘N’ pages under posts loop?
- I would like to have different styles for my posts based on the content of each post
- List custom taxonomy specific to one custom post type
- Shortcode not working with post counter
- Move Genesis Single Page/Single Post Title
- How to Make infinite loop of post
- WP_Query with custom post type ID
- display posts of custom post type with custom taxonomy
- Get post format
- Custom wordpress loop
- displaying content of custom post type
- Posts are not rendering perfectly [closed]
- Display post from custom post type
- Use post in multiple places on a page with multiple posts
- The loop does not show users
- If custom taxonomy else conditional [closed]
- How to fetch posts that are stored in the different table than (default) wp_posts?
- If/Else child list for Custom Post Type single template within loop?
- Checking for custom field in admin pages
- SEARCH QUERIES – REVERSE OUTPUT
- How can I check the rewrite slug of current post type listing page
- How to add custom PHP code in post header?
- How can I group by Taxonomy on Custom Post Type while filtering out based on custom Meta
- subtracting the current post form then whole loop, which is generating all CPT titles
- Display title of all custom posts from same taxonomy term on a custom post template
- Custom post Query and WordPress Post Query Clash
- Only show current category post
- How To Loop Through list with Custom Post Types
- How to create content automatically when a post is published?
- Turn post into simple slideshow
- Pulling in a particular post into a single page based on the post id passed into the code
- Styling first post using Advanced Custom Fields
- Loop to pull content from parent element in custom post type [duplicate]
- the_content() stop images being pulled through
- How to show Y number of custom posts after every X normal posts?
- Archive page…limiting posts per page
- Adding custom post type to loop
- How can I add dropdown widget/box to admin post page?
- functions.php conditional tag only for custom post type
- Custom permalinks – post type – hierarchical taxonomy’s
- Using new WP_Query in shortcode in a custom field causes the main post content to not display
- Taxonomy posts on Archive page
- Display taxonomy term only if there’s a value
- How to delete all posts from a custom post type?
- Update content of multiple pages/posts at once?
- CPT’s archive and single page not working [closed]
- Display custom field of specific post where post title matches variable
- Normal pages as children of my Custom Post Type
- What is the recommended / best way to do this: Event calendar post/type in a block-based theme?
- Group CPT posts by custom taxonomy
- Store CPT ‘Reviews’ average ratings to a WordPress DB table or to a DB custom table?
- The loop seems stuck to a single (now deleted) post
- Targeting custom post type
- How to sort posts in a custom post type by title in ascending order by default?
- Create new custom post and post category of same name
- Bootstrap accordion looping through posts incorrectly
- TinyMCE Buttons on Certain Post Type
- Search Filter CPT, Custom Loop
- Modify Posts from Custom_Post_Type within the plugin
- Why is the output of a call to the_excerpt different when the call seems to be identical?
- Show specific content on parent custom post type and all children
- Displaying Posts Using a Custom Query with a Custom Field and a term_id
- Only looping through pages that have children or subpages
- How to sort WP_Query by a custom text field (written as a date dd/mm/yyyy)
- list articles in admin showing nested categories or slugs?
- Define multiple prefixes for custom post type
- Show posts from WP Custom Post Type selected from a field in a metabox
- order custom post type posts by custom date
- Accessing download link from the loop with WP Download Manager Pro
- Custom WordPress theme not displaying posts from category
- Need to display author’s email id in the “Edit post” field in wp dashboard. How do I do this?
- call a function when insert and update a custom post type
- How to prevent post to repeat on my loop?
- Custom Post Type
- Custom Post Status & Taxonomies
- How to display data with pagaination on backend?
- Front-end form submission not creating post
- Load different template for CPT (in loop) in my plugin?
- Post being scheduled that shouldnt be schedulded
- Custom Loop and Standard Blog Loop Issue
- Custom Post Query Combined with Conditional Tags
- Custom loop won’t work, can’t find problem
- Categories and page filtering with pre_get_posts
- show the most recent date of all posts to display on front end
- Custom post type is_singular condtional not working when managing sidebar display
- Sort ACF by custom taxonomy