WordPress already has current-menu-item
class. Following CSS can be applied.
.current-menu-item{
background-color:#4ba668;
color: white;
display:block;
}
Thanks to bosco for his comment.
Related Posts:
- Is it possible to change post id for an already added menu item in WordPress?
- How to get a post’s content? [closed]
- Get page ID of page that is set as the posts page
- Where is the old post permalink slug stored?
- Use category base slug in posts’ permalink
- Get current post id in functions.php
- Custom Post Types, slug, archive and SEO plugins
- get all posts ID from a category
- How to automatically generate a unique random slug
- Get the current post ID as a variable in Javascript
- Is post ID number always incremental n+
- Change the Slug of Post Type post to baseurl/post/%postname%
- How to add post count to wp_nav_menu?
- How to control which category will be picked for the slug of a post?
- Change slug with custom field
- Determining Slug Before and After Edit
- Are all ID’s used unique?
- Adding a Nav menu to post admin
- At my posts archive page, outside the loop, get_the_id() returns the top most post’s ID
- Is it possible to show a different WP menu when using password protected pages?
- How to update all post at once?
- get post id in while loops outputting page id
- Undefined variable post_id in custom quick edit coloumn
- generate unique slug while inserting post
- WordPress menu that shows all posts in a certain category like w3schools
- Getting post id from wp_insert_post_data function?
- Does an article (post) id ever change?
- How to get the post’s parent ID?
- Is there a better, more efficient way to get the post id outside the loop?
- Getting current post ID in functions.php
- Mark menu item as current-menu-item for category
- Bulk update post slugs through database
- Sidebar links for different pages
- How blog page in WordPress works : blog page retrieve first post ID
- Blog Posts in Custom Menu
- Post-ID in url differs from $post->ID
- Why is my Blog Page ID == First Post ID?
- current post with current author
- How to create a submenu that will navigate through different posts in the same page
- How to get next post ID?
- One menu for frontpage (one pager), and a different menu for posts
- Automatically add date to the auto generation of post slug
- how do i add posts-page slug before posts slug in permalinks
- Using wp_list_pages() after calling query_posts()
- Show posts count for Categories and Tags in wp_nav_menu
- How to add category post count in main navigation menu [closed]
- Disable WordPress Archive Conflict Check
- How to I retrieve the ID from the Posts page?
- Crazy Question – Updating Post ID
- disable Tab post on nav-menus page (Admin)
- Why I can not I use the variable outside my function?
- How to Use index.php file for “Blog” Page And this is Not a Home Page
- Two Custom Post Types with Identical Articles Competing for the same Slug
- Is there a way to add the list of recent posts into the admin sub menu on hover?
- Replace image name on upload to the new post name on front-end form
- Deleted a user with administrator rights. Now all the data/content/images are lost. how to recover them back
- WordPress post filter menu
- Un-highlight Blog Menu Item when Category Menu Item is Selected
- Auto update post title and slug when post status is changed
- WP_Query custom field pass the post id
- Accessing Post ID Within Loop
- Are post, page and category IDs unique to each other?
- post type slug vs page slug
- Programmatically add posts from specific category to menu
- linking to post outside the loop
- Widget to show posts in the sidebar basing on its IDs
- Get a post’s ID
- Making posts permalinks consistent numbers
- How to get post id of last approved comment?
- How to output all taxonomy links from a custom post type in a menu?
- How to get the post id (of the parent custom custom type) in a loop inside a widget?
- Making a new post visible on a specific page
- WordPress – When visiting a `single post/ single.php` my category menu item link becomes active
- Menu Items disappearing/being empty on save or post edit
- Reuse old post ID for new post after deleting post
- Get post attachment with post id
- How to make certain posts not appear on the main page, but instead only a newly created category(in the menu section)
- Automatic Table of contents with categories and posts
- Slug collision between page, taxonomy and custom post type
- How can i take all ids from untrash_post action?
- How to add content to the menu
- If I moved the location of my generic “posts” page, do I need to change the slugs for all of the individual posts?
- Get from the dashboard the ID of the current post being edited
- Only get post_id [duplicate]
- display content in multiple columns
- post_name is not stored until post is published… where should I store my slug until it goes live then?
- Post as frontpage – avoid duplicate content
- Call posts of particular category in a page
- Add custom class to existing menu items from custom meta
- “Current” class on a singular page menu item with custom post types?
- Load Pages Menu in single.php
- unused post IDs
- retrieve post slug by post_tags taxonomy
- Show all posts in category
- Custom post page has attributes of latest post [closed]
- Echo author slug in post edit page
- Can I get custom post items in select box (dropdown)
- Is there any point to using wp_unique_post_slug?
- Dynamic Menu Item
- How to remove category and other tags from posts page