The reason it only works on category and sub-category pages is because is_category() checks to see if a Category archive page is being displayed. However a post is not an “archive page” it is a “single page” (see http://codex.wordpress.org/Template_Hierarchy). So you would need to add another condition in there that first checks to see if you are on a post page – using is_single() – and if so then retrieves the posts parent category and displays the sub-categories for that parent category.
Related Posts:
- Custom menu walker: how can i check first item
- How to add a child item to a menu element (using wp_nav_menu_objects)
- Primary and secondary menus
- how to get custom admin submenu( custom post type ) item to highlight when its active
- Walker nav remove submenu ul from a certain depth
- WordPress bootstrap menue with 3. level
- Subnav menu – adapt to show the same on parent, child & grandchildren pages?
- disable menu collapse/expand function and make a menu item a static, unclickable text
- Submenu causes issue in defined blog page
- Define supporting only 1-level menu
- Get the page IDs of a Particular Menu item’s submenu
- sub-menu does not show on the very top bar
- How to hide Newsletter plugin submenus from the Dashboard?
- How to exclude/remove submenu using Walker_Nav_Menu
- Links doesnt appear as a submenu on a mobile
- Notices are render inside sub-menu’s content
- Problem add submenu page
- Controlling the position of dropdow submenu
- Assign index page to my mobile site?
- Restrict days in bootstrap datepicker using checkboxes in submenu
- Need help finding information to create this type of page
- Trouble posting in Sub-Category
- Subpages List Appearing on Every Page
- Active class on side menu
- Show menu on page with all sub-pages and sub-sub-pages of that page
- WordPress two row automatic sub navigation with double wp_list_pages. Is it impossible?
- Horizontal sub-menu on one line
- How to add sub-menu to a menu generated by wp_nav_menu by using plugin
- Remove Categories / Tags From Admin Menu
- WordPress API Menu/Submenu Order
- how to create a menu with all sub categories?
- Remove a menu item created by a plugin
- Multi Level Bootstrap Navigation Menu in WordPress
- wp_nav_menu() loses ‘current-menu-*’ classes on single product page within category
- checkbox in post add/edit to add/remove the post from menu
- How to make pages metabox display all hierarchy in menu admin?
- Moving Categories submenu to Media, but still opens Posts menu
- Custom Nav Walker sub-menu HTML construct
- Subpages return 404 error [closed]
- Custom Walker for Walker_Nav_Menu
- Handling complex multi-level architecture / menu for large site
- How to display dynamic content in start_lvl function
- Create self-populating menu and add extra divs to the menu layout
- Two Navigation Menus – secondary nav is including main nav
- next_post_link() on custom menu structure
- How to add a submenu toggle button inside all “li” elements that have a submenu?
- Admin Panel – Custom Menu Sub-Item LINK
- Find the Children of a Page then Echo it as a Bulleted List of Links (menu)
- submenu item edit a specific post
- How to include a third level with wp_get_nav_menu_items function
- Schedule Page to Menu [duplicate]
- How do you manage large menu hierarchies in WP?
- How can I make this custom menu work?
- Trying to Create Menu in WordPress
- Add code to WordPress menu items by class
- Adding a submenu to the Tools menu returns tools.php in a popup box
- How to customize submenus isn wordpress theme [closed]
- Can I have a different menu for each parent page?
- remove class “sub-menu” from wordpress drop down menu
- Add a submenu to wp_nav_menu
- Wrap list parent in div with wp_nav_menu menu
- Access for adding subpages but not for pages
- How to remove and disable access to General Settings Page including its link
- Use current class method inside add_submenu_page()
- sub menu link is not working
- How to use wp_nav_menu to create custom dropdown menu?
- How to Add support for sub-menu item description in wordpress?
- How to hightlight all ancestor menu items of a child page NOT displayed in menu
- Add Login and logout buttons to top menu bar
- Removing Submenu from Menu
- wp_list_pages() not showing on posts
- Sub menu is not working properly
- WordPress custom menu can’t show 3. level submenu
- add sub_menu to a sub_menu (multiLevel sub_menu) in admin menu in wordpress
- Change hover to onclick on menu
- Bootstrap Theme Migrated to WordPress
- How to add all subcategories as submenu in WordPress menu
- having a page in multi sub-menu and match current-menu-item
- Why my dropdown menu is effecting main menu?
- Creating navigation out of specific IDs and their children?
- how to link local pages with flags in submenu
- Where to place a svg chevron down in my custom walker?
- Custom Walker menu depth opening problem
- How to access into the description of a sub menu
- Add subemenu option page
- Can’t hover on Submenu
- Adding span to a particular text in an menu item
- How put the correct URL to sub-menu plugin?
- Adding Meta Box to Specific Submenu Page
- How to separate sub-menu output and keep associated with parent
- Problem with sub-menu container
- Has there been any improvements to wp’s menu handling?
- How I can add div to menu?
- Show Child of Parent Page including all other parents
- How to display list of child pages with parent in wordpress?
- nav_menu: how to force a subpage switching on the parent menu
- displaying child pages in columns when on a parent page
- How can I alter the visible menu according to which level I am on [closed]
- Add wrapper for a specific sub-menu
- Add acf custom fields so sub item in menus