This question was also asked on stackoverflow. Here’s a copy of the answer i gave there:
Perhaps you could style it using the nth-of-type
CSS3 selector.
.current-menu-item:nth-of-type(1) {
background:#ffff00;
/* Highlight styles */
}
These styles would target only the first occurrence of the .current-menu-item. Likewise, you could choose to target the second with nth-of-type(2)
, et cetera.
Related Posts:
- wp_nav_menu not highlighting the current category when viewing a single post
- Open subcategories in submenu on click in primary menu
- Create menu / submenu from category subcategory and posts
- Give Children Unique ID’s
- Theme for subcategories
- Multiple categories for one menu item?
- Global navigation in multisite: problem with categories
- How to add all subcategories as submenu in WordPress menu
- omit categories from main navigation menu
- Get the children of the parent category
- How can I hide a category from Contributors in the edit/add new post screen?
- WordPress Multiple Category Search
- Creating “static” taxonomies to choose from, inside custom post type?
- wp_nav_menu not appearing for a couple pages
- Delete a specific category when deleting a user
- Trash bin for categories
- How to set up sub-categories for author pages?
- View category in the preview of Theme Customizer
- Block multiple categories from Blog
- Show posts of one category only with Custom Taxonomy on single.php
- Assign different category colours to different categories in the main menu
- Select category in custom query
- Is it possible to put next and previous category links?
- Can this navigation be done easily in WordPress?
- Apply custom category template to subcategories
- Hide post meta data on a specific category
- Custom Category/Subcategory structure
- 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
- Using Shortcodes in WP-Menus in WP 3.1 (via nav_menu_objects)?
- What is the advantage of using header-catname.php over is_category(‘catname’);?
- Remove ‘rel’ attributes from the_category() output
- in_category() works in single.php but not in page.php?
- Use a wordpress page to display a certain category
- How to display only posts assigned to a particular, isolated, subcategory
- Automatically adding categories and authors in custom menu?
- Highlight wp_nav_menu when category is selected
- Checkboxes in the category list?
- Automatically exclude categories from metabox based on title
- Restoring default article pagination on archives – Removing custom limits
- How to categorize posts under Category 1 and Category 2 which are separate lists of categories, and display them as separate lists in widgets
- How to wrap the list with custom class using wp_nav_menu?
- How to organize custom categories for filtering and selecting
- How to rewrite the post URL according to the category?
- Different menu navigation per category
- Creating Category Specific menus
- How to build a simple nav system of custom post type categories and its posts?
- Help with walker for nav
- Using my WordPress menu on another platform
- Display thumbnails for certain category posts
- Keyword search in multiple categories
- Create menu locations for each category in wordpress
- Building Menu from Woocommerce Product Categories
- How to make the ‘delete’ button inactive on some categories?
- Two columns in homepage each with one category
- Change div background acording to the selected category
- WordPress list categories dropdown with parent-child relation and child under it’s parent
- Multiple selection for wordpress widget
- how to nest specific category thumbnails inside different containers
- Wrong category nice name is displayed on archive page
- function query_posts disabling current_page_menu class
- How to add active state to the navigation links?
- Add code to header based on category for specific posts?
- Pagination doesn’t work on multiple categories
- custom query for both category and pages using global $wpdb;
- List post only under the category, exclude child category content
- Select posts that match multiple category names, must match all categories listed
- Custom Portfolio Page
- wp_list_pages() not showing on posts
- Last x Posted Categories?
- How would I make a function to dynamically determine if user is logged to change navigation menu text?
- I need advice on how to structure the categories according to the layout i have
- show only sub categories if available?
- Customize Widget Navigation
- Function add class to second menu specific items if the page has a certain category
- Next and previous links category infinite loop
- Category custom template is not showing correct posts
- Search Replace Database ONLY for posts of certain category?
- Need help to structure our a complex hierarchy
- Tag Menu items based on their categories
- Show posts from all categories
- Grouping parent categories into sections
- How do you add Author and date Published on Category Pages?
- get_adjacent_post_link excluded_terms ignored
- Category menu that filters out empty categories
- Transfering static site to wordpress and retaining category by month paginations
- Post in multiple categories do not include in previous / next post if one category in excluded
- display certain category on custom template page
- Make three menus with three category levels
- Remove the current item from a menu
- List all authors by matching custom meta data on a category page
- why is the delete option missing from just one category?
- How to prevent page re-sizing for mobile browsers [closed]
- Custom permalinks structure
- In category.php I need to get the next 10/previous 10 posts
- Woocommerce custom taxonomy order
- Update wordpress menu with woocommerce products
- Custom Menu (only showing direct cildren) ACF not showing