You’re using in_category()
outside of a loop, so you need to pass the post ID in as the 2nd argument.
eg, if (in_category( 'vid', $post->ID )) {
See Codex.
Related Posts:
- How to check if I’m on the last page of posts?
- Get top parent category
- Category page doesn’t use category.php, instead it redirects to homepage
- wp_update_nav_menu_item() to insert categories
- How to exclude uncategorized from permalink structure /%category%/%postname%/
- Redirecting specific category posts to subdomain
- Create product category and keyword search form in woocommerce? [closed]
- How can I prevent users from creating new categories?
- Get child categories when clicking on parent category
- How can I create a loop to build slides based on multiple categories using Coda Slider
- Saving two categories from two dropdowns in front end posting form
- Block multiple categories from Blog
- Best and Cleanest way to remove /category/ from category permalinks? [duplicate]
- Categories list loop – add separator every year
- How would you create a “weekly” archive?
- Exclude most recent posts from specific category in wp_query()
- wp_list_categories to show list of categories and the description
- How to display a description of a given category from a custom taxonomy
- What type of page should i use? static page or category page? and what’s the difference? [closed]
- Filtering by Category doesnt paginate correctly on the backend
- Change the_content() in Theme Thirteen
- wp_nav_menu not highlighting the current category when viewing a single post
- WordPress subcategories return 404 in custom template
- WordPress order categories by ID
- how to show the post category name
- Find out which user created a category or tag?
- Mod_Rewrite to show only last subcategory in URL
- wp_dropdown_categories() scripts working erratically on sidebar
- Access current post parent and sub category
- How to exclude the last post from a category(featured for example) from the main loop?
- Category RSS feed doesn’t show category name
- menu using category and tags
- Have parent category contain only one post?
- wp e-commerce group product by category [closed]
- Sticky post for each category on category pages [duplicate]
- Limit get_categories to show each category once
- get parent category only
- “Item not updated” when try to change category properties
- How can I tell what category I’m in– in the header?
- new WP_Query all post in a category inside the loop
- How to add orderby parameter for sorting on category.php
- delete category name in the pages
- How to display sticky or latest published post on the current category page it belongs to?
- How do I add a separator to my list of terms with get_category
- Category tags with comma’s
- Trying to create a Categorised Index (archive?) to use as my Home Page
- Filter posts by categories ajax is showing nothing
- How to display child categories of all parent category within a singe loop?
- How can I add a class to displays a category?
- How to show only the name of one category above each posts in frontpage?
- WP_Query – using category__and when one of the categories is 0
- Multiple categories for one menu item?
- Hide categories from frontend, but not admin / post editor
- Exclude categories from homepage not longer working
- Remove category link
- Post to inherit custom category background image from parent
- Related posts widget – category
- Editing Loop So It Targets Specific Tags?
- Pretty URLs with Categories and Tags
- Select posts that match multiple category names, must match all categories listed
- How can i display category title over thumbnail?
- Check boxes for showing categories
- Header Link function not working. Problem with bloginfo()
- WordPress category filters as subcategories
- Sort posts alphabetically by category/custom taxonomy, insert divider between different types
- Need help with major category and permalink re-organization
- Include home page template in specific category template
- How to use category slug with a regular page
- Display Category Name and Date Posted on Blog Post
- Modifying category order
- display current portfolio categories from a specific parent
- How to remove “Categories:” part after the post title? [closed]
- Please tell how to stop the category from showing up on posts
- how to get only grandchild category from a child category
- Editing categories crashes WordPress site
- Remove “category” from permalink with add_rewrite_rule
- Next and previous links category infinite loop
- How to hook into creating a category?
- show only terms from parent category
- show posts in archive page based on selected catagory
- Accessible Subcategory URL’s pages without using .php hack
- How to display total views of all posts of one category?
- Get the categorie name of Event Organiser plugin [closed]
- in_category(‘category-sluga’) returns true for Archive page of Category ‘category-slugb’
- get_categories returns top-level categories instead of child categories
- wp_list_category only showing to logged in uers
- Grouping parent categories into sections
- How to show “category” name?
- Display the category name of a post that is in two different categories
- Querying Multiple Categories With Different Offsets
- filter single_cat_title avoiding the breadcrumbs
- htaccess redirect for all categories converted to tags now showing 404
- Category page with gallery for each post
- (WordPress) How to get custom taxonomy parent name?
- Show one same template for two category
- Search functionality with multiple categories
- Make a menu visible for a single category and it’s content
- WordPress Loop Prob
- WooCommerce category display in custom page
- How to define category ID in an array?