Turns out what I needed is to use “in_category” NOT “is_category”.
Here is the solution:
<?php if (in_category(7)) {
echo 'yes';
} else {
echo 'no';
} ?>
Related Posts:
- Custom Post By Category
- WP_Query by a category id and a custom post_type
- Exclude a category from WP_Query
- Load custom posts with same tag as page
- category__in not working on custom post type
- How to get a list of term names of the custom post type im currently on in single.php
- List with categories, subcategories and posts of custom posttype
- New WP_query in template not working with CPT+category on some pages
- WP Query group/order by category name
- Adding a span when custom post type is updated
- List all custom post type posts from a given category?
- Display Posts of a Category in Alphabetical Order (Custom Post Type)
- Query Custom Post by Category
- Loop through categories and create tab for each
- Display children and grandchildren of a custom post type
- Getting all custom posts with a certain category
- Query Custom Post Types & category_name?
- WP_Query search posts by custom post type and custom taxonomy
- Conditional to modify query results
- WP_Query is printing out only one post when posts_per_page is set to multiple
- WP Query to displaying date and posts for that date?
- Return array of categories to php function for current post
- Querying Term Posts in Loop
- Get Post Primary Category
- Weird problem happening with custom taxonmy when creating/updating posts
- Can’t get order_by meta_value_num to work properly
- Pagination on category page with custom post types
- Taxonomy Archive: Display only one post per term from separate custom taxonomy
- Very Slow Page – How to Optimize # of Queries?
- How to show CPTs in term archive
- showing custom post types of a certain category only
- Get posts from a custom post type by child categories of a parent category
- Linking to the most recent post in a Custom Post Type
- How to make sure content doesn’t display if selection is empty
- Get parent categories of custom post type
- Show custom post type filtered by category
- forming WP_Query for posts of all post types but from specific categories
- WP Query with categories only shows one post and ignores the category
- Why is my category template ignoring post type?
- Make a custom_post translatable
- Configuring a meta query with multiple post types that have the same relationship on a single page
- Redirect to another page using contact form 7? [closed]
- Category.php template for custom posts
- How can I group posts by months and years?
- Loop increase number
- Using wp_query to modify the loop in index.php for a CPT
- Custom post types and ‘new WP_Query’
- Assign category a default post type
- Is This Code Efficient – Or is there a better way?
- How to include category name/id in wp_query for retrieving “custom post type” from a particular category?
- Assigning a category to a custom post type in WordPress
- Different options per post type in WP_Query
- Show message when query has no posts
- Undefined $post in wp_query
- List categories, subcategories and posts from custom taxonomy and custom post type
- Custom post type and custom taxonomy 404 on page 2
- WP Query results showing posts outside of category ID
- List latest post out of 2 custom post types
- Using Wp_Query, Json to add Highcharts series data
- Create query for both custom post type and category
- Displaying One Custom Post Type’s Content On Single Post of Another Custom Post Type
- foreach loop inside the loop creating duplicates in output
- Foreach loop returning more than one item when querying taxonomy
- How to properly use Categories with Custom Post Types
- Show the categories the current post has
- What is the best way to set the post category (Custom Post Type) automatically based on the one of the tags assigned to the post?
- Custom front-end form for adding post – Category problem
- set object terms after some some time of published post – functions.php
- Alike Shortcode using in Custom Shortcode
- Query custom post type that has a serialized relational advanced custom field value
- Sort custom post column by generated value?
- How to output custom post type title on custom page with category next to it?
- WP_Query – How To Query Only Custom Posts With No Children of Their Own?
- In the php, how can I have a category of a custom post type display?
- Tell wordpress to show a single page instead of an archive page
- Search result based on URL
- Get meta values from parent post and save in child post
- Custom Taxonomy – fields
- Only show categories that have posts within custom post type
- CPT post doesnt shows tags and category on backend admin page
- WordPress loop add heading before first of type
- Only show current category post
- How to make a shortcode for my WP_Query Loop? [duplicate]
- Strange behavior on WP_query
- get_post_meta for Custom Post Type ( CPT )
- Loop carousel slider in wordpress
- How to call Shortcode categories for custom post types?
- category_name not working in WP_Query
- WordPress multi-query not returning as expected
- Trying to combine multiple WordPress queries
- Custom Post-type not returning the right child_of
- Stop header code from showing in category page?
- Pagination not working on homepage
- Query Custom Post Type by Tag
- Get all custom_post_type posts + blog posts from one category in a single query
- Using tax_query to get single post per category
- How to manage wordpress knowledge base/wiki/posts collections
- Add Category names to post lists of custom post type
- Is it possible to make is_category() recursive?
- Display all categories (with link) of custom post type – WordPress