888888.888888.88""Yb..dP"Yb..8888b..Yb..dP.88b.88....db....8b....d8.88..dP""b8..dP"Y8
88__...88__...88__dP.dP...Yb..8I..Yb.YbdP..88Yb88...dPYb...88b..d88.88.dP...`".`Ybo."
88""...88""...88"Yb..Yb...dP..8I..dY..8P...88.Y88..dP__Yb..88YbdP88.88.Yb......o.`Y8b
88.....888888.88..Yb..YbodP..8888Y"..dP....88..Y8.dP""""Yb.88.YY.88.88..YboodP.8bodP'


88b.88.888888.888888.Yb........dP.dP"Yb..88""Yb.88..dP
88Yb88.88__.....88....Yb..db..dP.dP...Yb.88__dP.88odP.
88.Y88.88"".....88.....YbdPYbdP..Yb...dP.88"Yb..88"Yb.
88..Y8.888888...88......YP..YP....YbodP..88..Yb.88..Yb

March 5, 2008

Themery Blogged Title

This is the eighth post in my series, Themery : Blogged, where I blog about each step of a WordPress theme design.

A great design tip that I’ve always tried to keep in mind is to be prepared to just drop any feature if it turns out that it doesn’t work. That is what I have done a little with the navigation. The theme will still have navigation, of course, it just won’t be quite so complex.

Navigation Mockup

In my original design mock-up, shown on the right, I designed the layout to be several layers deep. So a user could select categories, and within that see a list of the last five posts in that category, and by hovering over each post see the excerpt from the post.

This idea was a good one. It allows users to browse the site using the navigation without hitting an intermediate page and so sounds like it adds a lot.

Having built it, however, I realised that it just doesn’t work with the minimalist theme.

In practice the additional levels of drop down cluttered up the white space and killed the feel that I am seeking. The extra utility actually reduced the good aspects of the theme so, in this case, less is really more. I hope you agree.

This is a screenshot of the navigation in action.

Navigation Screenshot

To create the menu I have used a an unordered list, centred using auto margins. Each list item has a top border equal to 21px, but set in EMs), padding of the same amount, and a span within the list item of the size dimensions to create the right hand border. The colour of the top border is determined by the class: static, or dynamic.

The large size of the top border prevents me from using a side border on the list item; when the text is resized upwards the borders would taper off and lose the structure.

The drop down functionality uses the Son of Suckerfish technique.

The interesting part of this navigation scheme; however is how it fits into WordPress.

I wanted to provide a quick and easy way of controlling the static pages that come at the start, and end of the menu, while allowing the dynamic options to act independently. To do this the navigation scheme uses two bookmark ( blogroll / links ) categories. Links with a category of, ‘mainmenu’ appear before the dynamic menus, and links with the category of ‘mainmenu-after’ appear after it.

The PHP that adds these in is included below:

[php]
/* Retrieve bookmarks and display them with an appropriate class */
$bookmarks = get_bookmarks('category_name=mainmenu&orderby=rating');

foreach($bookmarks as $bookmark){
echo '

  • ';
    echo '';
    echo $bookmark->link_name;
    echo '
    ';
    echo '
  • ';
    }

    Note that in the original query I have specified that link rating should control the order. This means that both the inclusion of static links, and the order they appear in is dealt with by existing WordPress admin features, requiring no alteration of the theme files.

    For the most part the dynamic links are handled using the standard theme tags, wp_get_archives, and wp_list_categories; however, I couldn’t find a similar function for tags and so I have used the get_tags function and output each using a foreach loop.

    [php]
    $display_tags = get_tags('orderby=count&order=DESC&limit=10');

    foreach ($display_tags as $display_tag){

    $tag_link_title = sprintf( _('Posts tagged with %s' , 'Fun with Minimalism') , $display_tag->name );

    echo '

  • ';
    echo '';
    echo $display_tag->name;
    echo '
    ';
    echo '
  • ';

    }

    Note that for the moment I have restricted this list to the 10 most used tags. I don’t know how many tags the average WordPress blog is likely to have but I think the user is likely to be overwhelmed with any more than ten. Even that seems like a fairly long list when displayed in a drop down menu.

    At the time of writing I haven’t produced the post specific list; however, it will operate in exactly the same way,albeit with a few less borders applied.

    I have replaced the tag code with the internationalised version, for the sake of consistency with the end theme.

    Theming Habari Vs Wordpress
    Habari vs wordpress?
    13 comments
    page 440
    Post Image The Easy Peasy Way
    Get post attacments?
    26 comments
    page 1065
    Are Child Themes The Best Option
    Wp child themes?
    15 comments
    page 1262
    Upload From Url
    Upload to url?
    6 comments
    page 326
    Silence Is Golden
    Silence is golden wordpress?
    3 comments
    page 213
    How To Add Sidebars To A Theme
    Html hot add a side bar?
    11 comments
    page 1053
    How To Add Sidebars To A Theme
    How to add picture to the wordpress sidebar on sidebarphp?
    11 comments
    page 1053
    Fun With Sidebar Tabs Styling
    Position of the tabs thematic?
    2 comments
    page 336
    Using Your Own Url Shortener
    Short url?
    4 comments
    page 1190
    Why I Ditched Disqus
    Styling disqus widgets?
    5 comments
    page 1175
    Wordpress 25 Exif Fields
    Wordpress exif?
    12 comments
    page 230
    Html 5 Gallery
    Html 5 gallery?
    6 comments
    page 1305
    Dont Mess With My Toot Toot
    Fun with toots?
    16 comments
    page 599
    Dont Mess With My Toot Toot
    Fun with toots?
    16 comments
    page 599
    Converting Wordpress Themes To Habari
    Habari timthumb?
    one comment
    page 694
    Wordpress 25 Exif Fields
    Habari timthumb?
    12 comments
    page 230
    Fun With Sidebar Tabs Styling
    Tabs with html css on same page javascript?
    2 comments
    page 336
    Using Your Own Url Shortener
    How to have own url short?
    4 comments
    page 1190
    Post Image The Easy Peasy Way
    Insert conditional image php wp?
    26 comments
    page 1065
    Using Your Own Url Shortener
    Run short url using htaccess?
    4 comments
    page 1190
    Dont Mess With My Toot Toot
    New posttype not displayed wordpress?
    16 comments
    page 599
    Quick N Dirty Replacement Text
    Wpupdatepost object?
    no comment
    page 122
    How To Add Sidebars To A Theme
    Wordpress sidebar above main sidebars?
    11 comments
    page 1053
    Html 5 Gallery
    Html5 simple wordpress theme?
    6 comments
    page 1305
    Updating Code Snippets Here
    Fun wordpress plugin?
    one comment
    page 1338
    How To Add Sidebars To A Theme
    Wp register sidebars?
    11 comments
    page 1053
    Html 5 Gallery
    Html5 wordpress theme?
    6 comments
    page 1305
    Post Image The Easy Peasy Way
    Get post images?
    26 comments
    page 1065
    Updating Code Snippets Here
    Wordpress fun plugins?
    one comment
    page 1338
    Post Image The Easy Peasy Way
    Wordpress get first image large?
    26 comments
    page 1065
    Using Wordpress As A Php Framework
    Wordpress create your own framework?
    2 comments
    page 335
    Improve Your Typography With Plugins
    Wordpress typography plugin?
    one comment
    page 721
    Quick N Dirty Replacement Text
    Dirty replacement?
    no comment
    page 122
      1 query every 1923 seconds, updated 1 seconds ago.
    Sunday, 11pm
     __
    (__)
       `

     Themery : Blogged – Introduction – WP FUN

    [...] 8. Sitewide Navigation. [...]

    Thursday, 12pm
     __
    (__)
       `

     Andrew

    Thanks Christoph, I will do that as well.

    Thursday, 10am
     __
    (__)
       `

     Christoph Voigt

    No need to kick yourself :)

    Personally I’d expect a theme supporting i18n that includes theme-options in the adminpanel to support i18n in there too.
    Consistency is something that should not be underestimated as it creates a feeling. If you see that a car has a nice green coat of varnish, you’d expect that green color to show up somewhere in the interior too.

    Giving the admins a consistent naming for the bookmarks in their own language would be nice.

    Wednesday, 6pm
     __
    (__)
       `

     Themery : Blogged – Introduction

    [...] Sitewide Navigation. [...]

    Wednesday, 6pm
     __
    (__)
       `

     Andrew Rickmann

    Christoph,

    I am curious as to your opinion on something.

    Should I I18Nise the name of the bookmarks used for the menu? It makes no difference to the user, but would let other language users name it according to their language in the admin screen.

    Any thoughts?

    Wednesday, 12pm
     __
    (__)
       `

     Andrew

    Hi Christoph,

    The moment I saw your name in my e-mail field I kicked myself because I knew what you were going to say. I intended to do it and it slipped my mind when I got engrossed in the type.

    I will make sure everything I have done so far is i18n’d before I go any further.

    Thanks for reminding me that I need to go back and see what everyone said was important to them when I asked the question.

    Wednesday, 11am
     __
    (__)
       `

     Christoph Voigt

    Hi Andrew,

    could you make the theme i18n ready by default? It’s not that much work when you’re developing the theme and (at least I) would really appreciate it when translating the theme into german.