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?
- Apply the_title() filter in post & page title, but not in menu title
- Use category base slug in posts’ permalink
- Are post ID’s reliable?
- 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
- Post slugs and images cannot have same name?
- 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
- Adding Post Counts to Menu (Nav) Programmatically?
- Determining Slug Before and After Edit
- Are all ID’s used unique?
- $post->ID displays wrong ID
- 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?
- Showing random content / pictures from earlier posts in a sticky post?
- Get the post_id of a new post
- get post id in while loops outputting page id
- How can I display a specific user’s first published post?
- Undefined variable post_id in custom quick edit coloumn
- generate unique slug while inserting post
- How do I get the slug of a custom taxonomy category of a post?
- What Defines What Category A Post Picks (if in multiple)
- Edit menu item title from edit page/post
- WordPress menu that shows all posts in a certain category like w3schools
- Getting post id from wp_insert_post_data function?
- How can I get the page url slug when ‘post_name’ returns an id?
- How to get posts by multiple post slugs? [duplicate]
- Does an article (post) id ever change?
- Define a name to the posts slug
- How to get the post’s parent ID?
- Can a page_id and a post_id be same?
- Is there a better, more efficient way to get the post id outside the loop?
- Getting current post ID in functions.php
- Buddypress activity id
- Mark menu item as current-menu-item for category
- Bulk update post slugs through database
- Sidebar links for different pages
- Create dropdown list post
- How blog page in WordPress works : blog page retrieve first post ID
- Disable most recent & view all (TABS) on nav-menu.php
- Blog Posts in Custom Menu
- Get latest posts from WordPress site without header, menu and sidebar
- 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
- Get ALL post ID’s export list (Only id’s. Php or sql not important )
- How to get next post ID?
- More then one menu items are assigned with “current-menu-item” class
- Search results posts_orderby and ID
- How to have posts have a parent in permalink like site.com/blog/postname
- One menu for frontpage (one pager), and a different menu for posts
- Automatically add date to the auto generation of post slug
- How to handle broken links created by permalink/slug changes?
- Visting slug for ‘post’ post type shows 404 not archive?
- Remove Custom Post Type Slug and add Custom Taxonomy to Permalink Structure?
- how do i add posts-page slug before posts slug in permalinks
- How to list recent posts in a wp nav menu?
- Retrieve post ID from “querying” URL
- Redirect to another page using contact form 7? [closed]
- 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]
- obtain the author id given the post id
- How to get ID of the page included with get_page()?
- 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
- WordPress custom post type with folder structure in slug
- retrieve the oldest post id
- How can I list posts by author?
- WordPress Menu options in the Admin: Posts for the dropdowns
- Is there a way to add the list of recent posts into the admin sub menu on hover?
- my post slug gets really long and I can’t change it
- Replace image name on upload to the new post name on front-end form
- Edit the post title from the frontend
- Deleted a user with administrator rights. Now all the data/content/images are lost. how to recover them back
- Show custom post with custom categories with specific slug
- 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
- Get current post’s nav menu name (term name)
- Accessing Post ID Within Loop