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.



    Wordpress title showing space?
    no comment on page 1371

    Wordpress fun?
    one comment on page 1376

    Live blogging plugin?
    4 comments on page 1258

    Wordpress 3 admin speed up?
    4 comments on page 1321

    Framework photoshop?
    3 comments on page 296

    Fun wp plugins?
    one comment on page 1376

    Habari vs wordpress?
    12 comments on page 440

    Wp tags vs categories?
    12 comments on page 7

    Wordpress rss seo?
    one comment on page 1361

    Photo albums html5?
    6 comments on page 1305

    Wordpress chat?
    no comment on page 1308

    Wordpress exif data?
    12 comments on page 230

    Css sidear tab?
    2 comments on page 336

    Wordpress theme html5 blueprint?
    6 comments on page 1305

    Wordpress shortcode in plugin?
    no comment on page 236

    Html 50 photo album?
    6 comments on page 1305

    Get the post attachement?
    24 comments on page 1065

    Wordpress plugin development 30?
    one comment on page 1373

    Wordpress plugin development 30?
    one comment on page 1373

    Disqus formatting?
    7 comments on page 1175

    Html5 photoalbum?
    6 comments on page 1305

    Html5 photoalbum?
    6 comments on page 1305

    Wordpress fun?
    one comment on page 1376

    Fun wordpress plugins?
    one comment on page 1376

    Url shortener ideas?
    4 comments on page 1190

    Url shortener ideas?
    4 comments on page 1190

    Html 5 photo gallery?
    6 comments on page 1305

    Multiple post navigation?
    no comment on page 1147

    Html5 photo galleries?
    6 comments on page 1305

    Adding images to a wordpress 3 post?
    24 comments on page 1065

    Html5 photo gallery code?
    6 comments on page 1305

    Wordpress multiple blog master?
    one comment on page 1376

    Wordpress 3 tableprefix?
    one comment on page 1376

    Wordpress 3 tableprefix?
    2 comments on page 1374

    Using wordpress as a framework?
    2 comments on page 335

    Single post image size?
    24 comments on page 1065

    Get featured image src wordpress?
    24 comments on page 1065

    Disqus wordpress mu?
    7 comments on page 1175

    Image gallery html 5?
    6 comments on page 1305

    Wordpress theimage?
    24 comments on page 1065

    Wpgetattachmentimagesrc size?
    24 comments on page 1065
      every 1732s, 1s ago, in 0.03s.
     __
    (__)
       `
     Themery : Blogged – Introduction – WP FUN

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

     __
    (__)
       `
     Andrew

    Thanks Christoph, I will do that as well.

     __
    (__)
       `
     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.

     __
    (__)
       `
     Themery : Blogged – Introduction

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

     __
    (__)
       `
     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?

     __
    (__)
       `
     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.

     __
    (__)
       `
     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.


    0.01s