in_category [ WordPress Function ]
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Check if the current post in within any of the given categories.
The given categories are checked against the post's categories' term_ids, names and slugs. Categories given as integers will only be checked against the post's categories' term_ids.
Prior to v2.5 of WordPress, category names were not supported. Prior to v2.7, category slugs were not supported. Prior to v2.7, only one category could be compared: in_category( $single_category ). Prior to v2.7, this function could only be used in the WordPress Loop. As of 2.7, the function can be used anywhere if it is provided a post ID or post object.
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- in_category - WordPress Codex
in_category() considers only the categories a post is directly assigned to (the checked categories in Write/Edit Post panel), not the parents of the assigned ...
codex.wordpress.org - WordPress › Support » is_category() and in_category() not working
in_category() tests to see if a given post has a category in that specific category and must be used in The Loop, but you are trying to figure out what the category ...
wordpress.org - Complex loop with in_category(): Part 1 — studiograsshopper
Sep 18, 2008 ... Magazine themes often use the WP_Query() function to display a specified number of posts, excerpts, titles etc, on the magazine-style home ...
www.studiograsshopper.ch - Why would in_category only return one post in a specific category?
May 14, 2011 ... So... what I'm trying to do is simple - get the post content for all posts, but only in a given category. Simple - filter the loop using in_category.
wordpress.stackexchange.com
Gebruikersdiscussies [ wordpress.org ]
- Amy Hendrix (sabreuse) on "Equivalent to in_category() for custom taxonomy"
- dermotholmes on "Equivalent to in_category() for custom taxonomy"
- Amy Hendrix (sabreuse) on "Equivalent to in_category() for custom taxonomy"
- jvandelaar on "Equivalent to in_category() for custom taxonomy"
- dermotholmes on "Equivalent to in_category() for custom taxonomy"
- jvandelaar on "Equivalent to in_category() for custom taxonomy"
- eric brockman on "Please, Anybody - Custom menus not showing up in posts, only in categories??"
- Rev. Voodoo on "Please, Anybody - Custom menus not showing up in posts, only in categories??"
- eric brockman on "Please, Anybody - Custom menus not showing up in posts, only in categories??"
- Rev. Voodoo on "Please, Anybody - Custom menus not showing up in posts, only in categories??"