Describe Your Pages, WordPress
May 24, 2008 3:41 PM
How can I make my navigation bar in WordPress look like this, without modifying the WordPress code?
I've fallen in love with Dan Cederholm's clean, simple site design, especially the navigation bar. I like the idea of a description under the link, but I can't figger out how to do it in WordPress, except by coding up my own, hard-coded navigation, or to hack the source code, which will most likely make upgrading a pain in the ass.
Is there a plugin I can install that'll do this for me? Should I try another method? Help!
I've fallen in love with Dan Cederholm's clean, simple site design, especially the navigation bar. I like the idea of a description under the link, but I can't figger out how to do it in WordPress, except by coding up my own, hard-coded navigation, or to hack the source code, which will most likely make upgrading a pain in the ass.
Is there a plugin I can install that'll do this for me? Should I try another method? Help!
delmol, it appears that he wants to be able to dynamically add pages and descriptions through his CMS of choice (being WordPress).
Here's a plug-in that will get you on the right path.
posted by self at 4:47 PM on May 24, 2008
Here's a plug-in that will get you on the right path.
posted by self at 4:47 PM on May 24, 2008
What's wrong with hard-coding it into the template? It's not like you can just start adding tabs willy nilly and not have it look awful.
In wordpress you can make your own name=value pairs. so on the "about" page, just create a variable called "tab" and assign it "about". And then in the template, you look up the value for "tab" and if it's "about" then you add a class like "on" to the "about" div. I'm too lazy to look it up the wp details, but it's something like: wp_meta("tab"). If your page is a post (or a bunch of posts) you just need to check the category_id.
if none of the above made any sense, you might want to find a theme that supports this and just crib the relevant bits.
posted by kamelhoecker at 7:14 PM on May 24, 2008
In wordpress you can make your own name=value pairs. so on the "about" page, just create a variable called "tab" and assign it "about". And then in the template, you look up the value for "tab" and if it's "about" then you add a class like "on" to the "about" div. I'm too lazy to look it up the wp details, but it's something like: wp_meta("tab"). If your page is a post (or a bunch of posts) you just need to check the category_id.
if none of the above made any sense, you might want to find a theme that supports this and just crib the relevant bits.
posted by kamelhoecker at 7:14 PM on May 24, 2008
I'm willing to bet that is hardcoded.
It is fairly trivial to have Wordpress do tabs for top-level 'Pages' (there's a function that returns them as a list), but I can't think of a good way of adding descriptions without some sort of silly backend hack that adds an extra field to pages. Now, you could do this as a plugin, but you'd either be adding a table that would store a description for each page or overloading an existing Wordpress field. I don't think either way is any less hacky than hardcoding, and they're both certainly more effort.
So just hardcode it. Sometimes the "right" way is the fastest way. If you find yourself changing the descriptions every week and it's a pain in the ass you can figure out a solution once your problem is better defined. Until then, hardcode. You sorta have to anyways -- all the Wordpress templates I've done where pages are tabbed will fail if there's too many pages. Wordpress does pretty well for legacy template code, from what I've seen, so chances are it'll be easier to upgrade than a custom plugin too.
posted by fishfucker at 10:30 PM on May 25, 2008
It is fairly trivial to have Wordpress do tabs for top-level 'Pages' (there's a function that returns them as a list), but I can't think of a good way of adding descriptions without some sort of silly backend hack that adds an extra field to pages. Now, you could do this as a plugin, but you'd either be adding a table that would store a description for each page or overloading an existing Wordpress field. I don't think either way is any less hacky than hardcoding, and they're both certainly more effort.
So just hardcode it. Sometimes the "right" way is the fastest way. If you find yourself changing the descriptions every week and it's a pain in the ass you can figure out a solution once your problem is better defined. Until then, hardcode. You sorta have to anyways -- all the Wordpress templates I've done where pages are tabbed will fail if there's too many pages. Wordpress does pretty well for legacy template code, from what I've seen, so chances are it'll be easier to upgrade than a custom plugin too.
posted by fishfucker at 10:30 PM on May 25, 2008
You could do it the way Dan does: With Movable Type. It's free, can import your WordPress entries, has fewer security vulnerabilities, and you don't need to edit code to create templates that do what you want.
posted by anildash at 8:06 PM on May 26, 2008
posted by anildash at 8:06 PM on May 26, 2008
This thread is closed to new comments.
<div class="title">title</div>
<div class="subtitle">description</div>
posted by delmoi at 4:08 PM on May 24, 2008