Unless you have added the functionality with a plugin or custom code, Pages are not placed in Categories. Pages are organized with Parent Pages and Children Pages. This is why (I suspect) in_category() does not work in page.php
The following code in functions.php will add categories to Pages.
/**
* Add categories to Pages.
* from http://shibashake.com/wordpress-theme/add-tags-and-categories-to-your-wordpress-page
*/
function add_custom_tags_box() {
add_meta_box( 'categorydiv', __('Categories'), 'post_categories_meta_box',
'page', 'side', 'low');
register_taxonomy_for_object_type('category', 'page');
}
Hope this helps.
Related Posts:
- How to have a static category/author page?
- Create single.php for specific category by category id
- custom query for both category and pages using global $wpdb;
- Custom Portfolio Page
- How can I make a category function as a page?
- Need help to structure our a complex hierarchy
- Getting page/category content to show up in my custom page template
- How to check if I’m on the last page of posts?
- Gutenberg editor add a custom category as wrapper for custom blocks
- How can I hide a category from Contributors in the edit/add new post screen?
- WordPress Multiple Category Search
- How to remove categories filter from wordpress admin?
- Using single.php from plugin folder instead of default template folder
- How do I get the category URL from get_the_category?
- Decreasing the Memory Consumption of a WordPress Site?
- Posts in multiple Categories different single.php
- Multiple Domain Names – One WP Install (non-Multisite) – Default Each Domain name to Category Archive
- How can I select a primary category?
- how to use a different domain/subdomain for authors/catagories on single site?
- Deleting default category in wordpress
- Delete a specific category when deleting a user
- Get page content by category or tag
- How to list child categories in custom category template?
- Trash bin for categories
- Category page showing posts from all categories
- Loop with Dynamic Categories
- How to set up sub-categories for author pages?
- View category in the preview of Theme Customizer
- How to get a list of term names of the custom post type im currently on in single.php
- Create a full width responsive header image per page
- Remove child products from woocommerce category page [closed]
- One WordPress Install, Two Categories. Each Category Gets a Domain
- Using same slug name for a page and category
- Block multiple categories from Blog
- Remove “Category Archives: title” at the top of a category page [duplicate]
- Listing all posts from current category on page
- Show posts of one category only with Custom Taxonomy on single.php
- I use same slug name for category and page
- Save metabox checkboxes values to custom content type
- Select category in custom query
- Page with the same name of a category
- Remove “Parent” Selection When Adding/Editing Categories?
- How to get category id in single.php wordpress?
- Show posts of category in a page
- Order Taxonomy Term by date created
- Show pages and articles in category search result
- How to create taxonomy values for pages and list them in wp-admin
- What type of page should i use? static page or category page? and what’s the difference? [closed]
- Apply custom category template to subcategories
- Hide post meta data on a specific category
- Duplicate Category and Page URL loads Category instead of the Page
- Format Brand value in Category view [closed]
- Add custom taxonomy under the category title
- How to show in search results posts with a particular tag in a particular category?
- Add a specific category at a specific place to the menu that uses wp_list_pages
- What is the advantage of using header-catname.php over is_category(‘catname’);?
- Remove ‘rel’ attributes from the_category() output
- Multiple menu items highlighted
- Code to pull in a PHP file named after the category ID
- Viewing category pages without the word ‘category’ in URL
- Add title, post content, and category like add_post_meta and update_post_meta
- loop in single.php of the same category
- problem with filter of custom portfolio categories
- Deleted categories still listed until additional page refresh
- Category custom template is not showing correct posts
- Search Replace Database ONLY for posts of certain category?
- Display Some text in some specific category not all category
- displaying one category on one page
- Default URL for category dropdown select option
- Media Library Category Exclude Tree
- Multiple if statements with else for get_the_category [closed]
- When category name and title are the same … WP will select archive.php instead of single.php
- Filter custom taxonomy posts via AJAX
- How to associate dynamic PHP page for chosen WordPress tag?
- Adding a category view to a page
- Cant get unique_array() work on get_the_category() foreach loop
- Using template file for single post in sub-directory multisite
- How to add Pagination to foreach loop to page
- Showing the project type in HREF
- Category For Pages In WordPress
- Inserting categories as a hierarchical terms from frontend form
- Show posts from all categories
- How to add a post with new Taxonomy without assigning to default category?
- Code to display category-specific single.php is overriding normal single.php, too
- How can I modify this code to iterate over an array of categories?
- Paginations in Category Page Leads to Sample Pages
- Using categories and pages in menus
- How do you add Author and date Published on Category Pages?
- If it is a top level category show children otherwise show sibling categories
- Using wp_list_pages to create 2 lists of pages and include and exclude some of them depending on their category
- How to use PHP code with wordpress page
- foreach,having wp_query inside, breaks after showing one result
- Category foreach Paging
- Display Referring Category on single post?
- Pages with posts filtered by category
- Own Custom Tags/Category page ( posts)
- Gettind 404 not found wen click the view button for a given category custom post type portfolio
- How to create default categories in new installs?
- Modify / Rewrite single template url structure
- Show a Category Specific Info Box