Category Archives: Wordpress

Highlighting Menu Items in WordPress

With WordPress 3.0 came 3 new style classes that allow you to fully style the menu items to your liking. The classes are:

.current-menu-item
.current-page-ancestor
.current-post-ancestor

If they are missing from your stylesheet – they probably are – make sure to add them and define properties for them. Together with the good old “.current-page-item” you can finally highlight the menu items all the way. When on a page, when on a subpage to that page, when in a category and when in a post in a category. These classes saved my day. I hope they will save your day too.

Time to highlight your menu!

Displaying code in wordpress

There are a few ways to show your readers actual html code, php code or any other code without getting it converted by the browser into whatever the code is supposed to do.

1. The simplest approach is to replace the left < and right > brackets encompassing the code with the corresponding HTML characters for the brackets although this might get tedious if you have a lot of code to show.

2. If you are running wordpress you can simply install a plugin for this instead. This will give you more flexibility. I recommend the “Qoate Simple Code Snippets” plugin. Simply search for it through your wordpress plugin interface.