Mark parent category menu active on single custom post view in WordPress

Recently I developed a theme for one of my client and I had to highlight the menu item of parent category in main menu when one of its associated single custom post is viewed. For that I had to add an action in my functions.php file for nav_menu_css_class. What is does is it returns the … Continue reading Mark parent category menu active on single custom post view in WordPress

Advertisements

Displaying Titles in Multiline in WordPress

When title is written it is usually displayed in single line on front-end until it is too long to display in one line. But if you want to write title in multiline and want to line break the title after a certain word how can you do that. It is pretty simple. Since, we know … Continue reading Displaying Titles in Multiline in WordPress

Different color for each menu item

In a recent project I got a requirement that each menu item should be highlighted in different color when visited. The menu items and their required active colors were: Home - Green Portfolio - Blue Team - Yellow Contact - Red These colors were to be applied only when that page is being visited otherwise … Continue reading Different color for each menu item