Advertisement
  1. Code
  2. Theme Development
Code

Creating a Metro-Style Homepage With the Isotope JavaScript Plugin

by
Difficulty:IntermediateLength:ShortLanguages:

Microsoft's Windows 8 may not be success story as far as user experience is concerned, but it certainly introduced the world with a new design concept: Metro.

Since its emergence in 2012, it's become extremely popular with its flat, simple, and colorful looks. In this article, we're going to see how we can build a blog's homepage with the design concept of Metro.

How Do You Define the "Metro" Design Language?

Metro is the codename of Microsoft's latest style guide, or "design language". Although its simple, minimalistic approach was introduced in some of Microsoft's software (like Windows Phone 7 and Windows 8), web and graphic designers quickly embraced and incorporated into their designs.

It wouldn't be controversial to say that along with Google's design concepts, Metro helped the world wide web create the flat design trend.

Although Wikipedia defines Metro as "a typography-based design language", we might argue that it's more than that. In my opinion, there are three important characteristic features of the Metro style:

  • Simplicity: With simple square & rectangular boxes and proper usage of white space, Metro's main characteristic feature is simplicity. Most graphic and web designers already had a tendency to simple design, and Metro's ultra-minimalism was quickly caught on.
  • Typography: Typography became a huge element in web design, especially after 2010. (I'm keeping Swiss designers apart, by the way - those guys knew it all along!) Microsoft's bold move of putting forward typography against Apple's skeuomorphism was happily accepted by the design communities, making Metro a success.
  • Colorfulness: One of Metro's greatest achievements, as far as I'm concerned, is the use of matte colors. The web was agonizing with silver/chrome gradients, glass effects and exaggeratively bright colors; and when Metro came along, web design communities swiftly held on to its calm, "flat" colors.

More than these features, Microsoft defines Metro with five principles:

  1. Pride in craftsmanship
  2. Fast and fluid
  3. Authentically digital
  4. Do more with less
  5. Win as one

A tiny note on the name "Metro": Due to copyright issues, Microsoft had to change the name of this design language to "Microsoft Design Language" or "Modern Design", and the applications are called "Modern Apps" instead of "Metro Apps"; however, the name stuck among designers. This article will continue defining the design language with its codename "Metro", but keep in mind that the design language is officially called Modern Design.

Introducing Isotope: A JavaScript Plugin for Magical Layouts

To achieve a Metro-style homepage layout in a WordPress blog, we're going to utilize a fantastic JavaScript plugin called Isotope. The plugin's layout options are going to help us build a fancy, responsive Metro homepage. (The plugin works as a jQuery plugin, too, but we're going to go with vanilla JavaScript.)

In this tutorial, we're going to be using a beta version of Isotope - version 2.0.0-beta.8, to be exact. It's different than version one, but it should behave the same in the stable releases of version two in the future.

The PHP & HTML

If we were doing an HTML tutorial, I would paste the following code:

But we need WordPress code! Here's how we do it in WordPress:

A few notes on the code:

  • Notice the js-isotope class and the data-isotope-options attribute in our container DIV. These help us initiate the Isotope plugin without any JavaScript code.
  • If you want one of your posts to stand out, you can double its width by adding a post meta with the key metro-double and the value yes.
  • You can add more colors to the array (and the CSS code). I used the colors that I found here.

The CSS

Remember: This tutorial contains the basic CSS code to create a Metro-style layout, but they might not work for your design. If you feel that something's not right, you should play with the code a little bit to make it work for your own theme.

The JavaScript

You know what? We don't need any JavaScript code! Since we added the class name .js-isotope to our container DIV and provided Isotope's options with the data-isotope-options attribute, we don't have to do anything else. Isotope just finds the .js-isotope class, gets the options and runs itself.

Neat, right?

The Result

The result below is actually an HTML output, but the same will apply when you put the WordPress code above into your theme:

Final Words

A Metro-like interface isn't hard to mimic in web design, and as you can see, it looks beautiful. (You can do even better than this by improving my code!)

In addition to that, Isotope is a pretty nice plugin for us to provide a responsive layout to our visitors. It actually has even more features like sorting and filtering items but naturally, we didn't need those while building a homepage for our blog.

What do you think about the Modern Design Language? What do you think about Isotope? What do you think about this tutorial? Share your comments below!

Advertisement
Advertisement
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.