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
- Default post showing more than intended
- button onclick with get_post_permalink
- Show the same Article Available in Other Categories
- get_attached_media() on author page not working
- Getting posts under the custom post type ui category
- How to make sure content doesn’t display if selection is empty
- Show one item per category of a custom post type
- Storing posts from query and accessing later via AJAX call
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- If post has custom field then display css-class
- Meta Key Value in current-user-only loop
- How to display all posts from standard posts to custom post types in a loop with pagination?
- Calculate all custom field values in the post loop
- CPT + CMB2: data not displaying for only first post in loop
- Display only one post each WEEK
- Get next and previous 3 posts in a term in single post page
- List children on child post
- Restrict custom post type from appearing with ?post_types=
- Show custom post type filtered by category
- Loop custom taxonomy to get lists of cutom post types?
- create parent post using wp_insert_post
- Turn on and off custom post type from admin?
- Missing Posts in Custom Taxonomy List
- How do i calculate the total of values of custom fields in custom post types?
- Display random posts, but omit the post it is on?
- Multiple Loops On Custom Post Type Template?
- How do I do this with WordPress? Taxonomies?
- Custom loop with multiple taxonomy queries
- Disable block with taxonomies at post page
- How can i add thumbnails images to particular post (using code not admin pannel) in wordpress
- Checking if Post Title is Unique as Loop Criteria
- Custom post type not displaying content from single-{custom post type} page
- Showing posts from different categories and from custom post type
- Get latest 3 posts from multiple CPT in one query
- Register widget only page is a singular of custom post type
- Allow non-logged in users to see a future post after clicking on a list of future posts
- Which post does a taxonomy term belongs to?
- Custom post type multiple loop by taxonomy term
- Is there a conditional tag to determine whether the post is _any_ custom post type?
- Conditional Query of Custom Post Type and custom taxonomy
- Show a Category X’s custom post type on Category X archive page?
- Post image in WordPress not appearing on home page
- Paging doesn’t work?
- How to add a custom-post-type post within another custom-post-type post edit screen using AJAX?
- Meta query for custom post type ignored in main query
- Changing custom type name hides the posts
- Sort by alphabetical order archive.php page
- What is the recommended / best way to do this: Event calendar post/type in a block-based theme?
- Display Ad on Specific Categories
- Custom Tag Description unable to display just below and outside of the Loop
- Hiding posts by other users and non-logged in
- Display all taxonomy terms, add class if term applies to current post