• 3D
  • Illustration
  • Web Design
WordPress: Highlighting Current Page

I have recently discovered the power of WordPress, and I am loving it! Its capacity as a CMS (content management system) is very robust—much more versatile than I had ever imagined. It is almost limitless what you can do with it. But there was one catch that I ran across in my endeavors to bend WordPress to my will: How do you highlight the current page being viewed?

As I did my research, I was surprised to find that the various techniques deployed to activate this feature were very evasive; nothing that you would call native or simple. This perplexed me—I would have expected to find something more built-in.

Well, as I dug deeper, I found that there is something simpler— something much more native and natural. Despite this fact, finding documentation on the technique was surprisingly difficult and almost non-existent. I assume this is because it is new to version 2.7. Read below to see how it’s done . . .

Here’s what you do: simply add the class “.current_page_item a” to your stylesheet (style.css) along with whatever rules you need to style this class, and voila! It’s done.

Example:

.current_page_view a {

background: ('images/active_img.jpg');

Note: In order to change the actual color of the text, you will need to add the rule “!important” to your color property, in order to get it to change. Everything else should behave as normal.

Example:

.current_page_item a {

color: gray !important;

}

You can also view this post on siteCLIQUE.com.

Comments:

Leave a Reply

Spam protection by WP Captcha-Free