WordPress Ribbon Menu with CSS

For a recent project I was asked to replace a Flash site with a CSS/HTML version which was to match the existing look as closely as possible. This was essentially straight forward apart from the menu that was needed. The menu had a ‘wrapped ribbon’ affect on the currently visited item.

Flash Ribbon menu

Flash Ribbon menu

What I’m going to do here is run you through how I replicated this in CSS/HTML on a WordPress powered site. The finshed menu should look like the following;

CSS WordPress Ribbon Menu

CSS WordPress Ribbon Menu

The approach I took was to use the built in wp_nav_menu hook in WordPress to display the menu (which gives a lot of control) but to pass in an extra parameter to the call to define an extra div with a class defined which would be output before the link text.

wp_nav_menu( array( 'container_class' => 'menu-header','theme_location' => 'primary','link_before' => '<div class="ribbon"></div>') );

With some fairly standard CSS (all source can be found below) I now had a menu which looked like the following;

CSS Ribbon Menu Work in progress

The trick now was create the actual wrapped ribbon affect… and to do this I gave the selected item negative left margin

margin-left: -20px;

CSS Ribbon menu work in progress

The next step was to creat an image to make it look like the ribbon wrapped back around the menu. This is simply a triangle image with a radial gradient along it’s angled edge to give a feel of depth. For my menu the image I used was this one.

I then assigned this image as a background to the div element we added earlier in our wp_nav_menu call for the selected menu item.

#access ul li.current_page_item .ribbon {
float:left;
background:url(../images/ribbon_triangle_02.png)  no-repeat;
position:relative;
top: 38px;
left: -11px;
width: 20px;
height: 20px;
}

And there you have it… our finished article

CSS WordPress Ribbon Menu

CSS WordPress Ribbon Menu

#access .menu-header,
div.menu {
	font-size: 13px;
	margin-left: 0px;
	width: 100%;
}
#access .menu-header ul,
div.menu ul {
	margin: 0;
}
#access a {
	color: #fff;
    background: #333;
    background-image: -moz-linear-gradient(-65deg, rgba(51, 51, 51, 1), rgba(51, 51, 51, 0.6)20%, rgba(0, 0, 0, 0.8) );
  background-image: -webkit-gradient(linear, left top, right bottom, from(rgba(51, 51, 51, 1)), to(rgba(0, 0, 0, 0.8)), color-stop(20%, rgba(51, 51, 51, 0.6)));
	display: block;
	line-height: 38px;
	padding: 0 10px;
	text-decoration: none;
    border-bottom: 1px solid #000;
}
#access li:hover > a,
#access ul ul :hover > a {
	background: #ccc;
    background-image: -moz-linear-gradient(-65deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.4)30%, rgba(0, 0, 0, 0.6) );
  background-image: -webkit-gradient(linear, left top, right bottom, from(rgba(0,0,0,0)), to(rgba(0, 0, 0, 0.6)), color-stop(30%, rgba(0,0,0,0.4)));
	color: #000;
    border-bottom: 1px solid #000;
}
#access ul li.current_page_item .ribbon {
  float:left;
  background:url(../images/ribbon_triangle_02.png)  no-repeat;
  position:relative;
  top: 38px;
  left: -11px;
  width: 20px;
  height: 20px;
}

#access ul li.current_page_item > a,
#access ul li.current-menu-ancestor > a,
#access ul li.current-menu-item > a,
#access ul li.current-menu-parent > a {
	color: #444;
    background: #15c692;
    background-image: -moz-linear-gradient(-65deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.2)50%, rgba(0, 0, 0, 0.3) );
  background-image: -webkit-gradient(linear, left top, right bottom, from(rgba(0,0,0,0)), to(rgba(0, 0, 0, 0.3)), color-stop(50%, rgba(0,0,0,0.2)));
    border-bottom: 1px solid #000;
    margin-left: -20px;
}
* html #access ul li.current_page_item a,
* html #access ul li.current-menu-ancestor a,
* html #access ul li.current-menu-item a,
* html #access ul li.current-menu-parent a,
* html #access ul li a:hover {
	color: #444;
    border-bottom: 1px solid #000;
    background: #15c692;
    background-image: -moz-linear-gradient(-65deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.3)30%, rgba(19, 185, 136, 1) );
}
Posted in design, technology, wordpress | Leave a comment

Android – Getting apps to appear on the market

When I first started working on Asssist for Gingerbread Design we all knew that we wanted the app to be available across as many devices as possible. We wanted to cover devices with smaller screens and lower densities such as the HTC Wildfire as well as more advanced devices. Little did I know that being able to do this would take so much searching and trial and error.

And even after trying the app out the on the Android emulator with it’s settings to match the Wildfire (which seemed to work OK) when we came to launch the device in the Google Market it seemed that the device wasn’t being displayed to all users.

We were told our app didn't appear on the market

We were told our app didn't appear on the market

Then, after weeks of searching I came across a little gem of info (sorry can’t remember where)… all you have to do is include the following in your project’s AndroidManifest.xml file.


This seemed to work for me and I hope it does for you too.

Posted in android, technology | Tagged , , | Leave a comment

Android emulator not installing apps – a solution

During my revisit to app building for the Android platform I started to notice that the emulator (when using Eclipse) was a bit hit and miss when it came to loading the freshly compiled applications onto it. After much surfing on the web I had found that some folk had seen partial succes when killing the adb server. I played with this and I too had some partial success. Then after much trial and error I struck upon a solution that works everytime… it’s not pretty but it does do the job.

The Solution – Installing apps on the emulator

So what I do is this;

  1. Start eclipse
  2. Start the emulator… let it get to the point where it is fully loaded (i.e. at the home screen)
  3. From the command prompt kill the adb server with the command adb kill-server. This adb command is in my C:Program File/Android/app-inventor-extras folder on my windows setup (your may be different)
  4. The above command will cause eclipse to try 11 times to re-initialise the emuulator link. While this is happening (and after) I click the run button… I do this every second until the output in the console tells me that my app is being installed.
  5. Voila!

And that’s it… like I said it’s not pretty but it does mean that my apps install onto my emulator. Note this only needs to be done once, perhaps to set up the link between eclipse and the adb.

Posted in android, technology | Tagged , , , | 2 Comments

How not to get our support

I just received an email from a lovely guy/gal complaining about how they wasted some time trying to get one of our plugins working. Sadly in this case we’re not going to even bother to help them sort out the issues but instead are going to use them as an example on how to not get our support.

So here we go… things to remember or take note of when wanting help;

  • Ask us… yup that’s quite important!
  • Our plugins are free
  • We generally do not charge people for adhoc support for our free plugins
  • Be polite… ’nuff said on that one
  • Even if we can’t help there’s a huge community at WordPress.org that are more than likely to be of some assistance

And there we have it… it’s not a tough list to take in and we believe that most of the things on there are common sense too.

Oh, almost forgot… here’s the mail that we received… so if you do want our help it’s best not to use this as a template.

Wasted 2 hours trying to figure out your instructions for pages plugin. When you make something you really should try to write more the what you did for this. I just erase of the site and gave up.

Posted in small business, technology, wordpress | Leave a comment

A Responsive Twenty Ten WordPress Theme

UPDATE: Although the following still exists and is available I have now released a WordPress plugin which gives the same output as the child theme but with the added benefit that it is hosted on the WordPress.org repository. The plugin can be downloaded here.

After reading about Jon Hicks implementation of media queries on his site to make it more responsive to user’s browsing context and the release of the (highly recommended) latest WordPress build I thought it was time to get my feet wet with Responsive site design.

After toying with the idea of implementing this on one of my client sites I thought “Hey! hold on I’m using WordPress 3.0 default theme on my blog… why not extend this?”. And so that’s exactly what I’ve done. I’ve created a child theme for TwentyTen which not only makes it fluid (up to 940px) but also makes it more responsive at smaller sizes. As well as these I’ve added some extra CSS to make it handle iphone and android browsers too thanks to some interesting articles by The CSS Ninja and riklaunim

The result of this the current 0.1 version of the Responsive Twenty Ten WordPress theme. It should be noted that this is a current work in progress which is one of the reasons that I’ve not published it to the WordPress.org themes directory just yet. There are a few known issues still too;

  • IE fluidity is not implemented – seemed to cause issue with the CSS introduced to pick up mobile resolutions (portrait and landscape).
  • Mobile (read Android and iPhone) have some issues dealing with the orientation. Still looking into this. Update – fixed ;-)
  • Requires use of some JS for IE (though I’ve disabled this at the moment.]
  • Not got round to validating the CSS yet (naughty naughty, yes I know). Update – fixed ;-)

The theme is essentially a fluid version of the default Twenty Ten theme with a fixed maximum width. The extra “responsive” magic comes in when the browser viewport width drops below 661px. What then happens is that the primary and secondary sidebars drop below the main content and appear just above the footer. Some tiny extra rules come into play for iphone and android browsers too to make the page layout flow better.

By all means download the theme in it’s alpha state and let me know your views. Of course you can just have a play with this site as I’m using it at present too.

Posted in design, technology, Uncategorized, wordpress | 42 Comments

Advanced WordPress Page Layout Experiment

Styling WordPress page and post layouts can be daunting for the novice… especially if you don’t want to dirty your hands with PHP and the like. I wanted to experiment with what was possible to do using only the default WordPress theme 2010 and plugins alone (OK, some CSS was needed).

So I set myself the challenge of mirroring something which is a classic layout across news sites and ended up with the perfect example from the BBC News web pages (please someone let me know if I’m NOT allowed to publish the below pic).

Extract of the BBC News site, the desired layout

Extract of the BBC News site, the desired layout

The desired layout is essentially a main news article with a supporting image followed by a couple of secondary articles and then a listing of tertiary articles.

My initial ideas came from using the Widgets on Pages WorPress plugin that I had developed which allows the addition of sidebar areas to be inserted inline in pages and posts. Using this plugin I was able to essentially define multiple areas in a standard page (using a standard template) which could then have independant content defined and (with some tweaks to the live version of the Widget on Pages plugin) could be styled each in it’s own way. This, by itself, was limited though as I really needed some mechanism to pull in the desired stories… I needed something to support it.

Then at the recent WordCampUK 2010 I was lucky enough to be attending Michael Kimb Jones‘ presentation on WOW Plugins when the Query Posts plugin (by the incredible Justin Tadlock) was brought to my attention. The plugin provides a widget can be set up to be populated with the result of a query against the posts in the database. Kimb actually mentioned that he had thought of producing an entire WordPress site just through widgets… a very similar one to the train of investigation I was pursuing. This Query Posts plugin was the answer.

I put this plugin to work (with some slight mods to now use WordPress featured image feature) alongside my own Widgets on Pages plugin and some additional CSS to the 2010 theme to come up with a layout that is indeed on the way to what I was after.

Screenshot of layout

Adv layout with no template messing

The page content actually consists of only the following content;

[widgets_on_pages id="featured_news"]
[widgets_on_pages id="also_in_the_news"]

To support this I have 2 sidebar areas defined (featured_news and also_in_the_news) which each have Query Posts widgets in which pull in the news feed with each one offset to allow idea of one single feed.

The CSS used to stylize these is as follows (yes I know it’s not clean… this is an experiment remember);

.featured_news {
width:650px;
border: 1px solid grey;
border-width: 0  0 1px 0;
overflow: auto;
padding-bottom: 8px;
}

.also_in_the_news ul li {
float: left;
width:290px;
padding: 0 0 0 0
}

.also_in_the_news  {
margin: 5px 0px 10px 0;
border: 1px solid grey;
border-width: 0  0 1px 0;
overflow: auto;
width:650px;
}

.also_in_the_news ul li:first-child {
float: left;
width:290px;
margin: 0 0px 0 0;
}

.widgets_on_page ul {
list-style: none;
}

.widgets_on_page h2.widgettitle  {
font-size:1.2em;
}

.widgets_on_page h2.post-title a  {
font-size:0.9em;
}

.featured_news h2.post-title a   {
font-size: 1.5em;
}

.widgets_on_page .entry-summary {
clear: both;
padding: 0px 0 0 0;
font-size: 0.8em;
line-height: 1.5em;
font-family: arial;
}

.widgets_on_page  {
font-size:0.9em;
}

.widgets_on_page .hentry  {
margin: 0 0 5px 0;
}

#content .widgets_on_page  p,
#content .widgets_on_page  ul,
#content .widgets_on_page  ol,
#content .widgets_on_page  dd,
#content .widgets_on_page  pre,
#content .widgets_on_page  hr {
margin-bottom:5px;
}

img.attachment-thumbnail {
float: left;
}

.also_in_the_news img.attachment-thumbnail {
display: none;
}

.featured_news .words {
margin: 0 0 0 20px;
clear: none;
float: left;
width: 440px;
}

li.widget li a {
font-family: arial;
text-decoration: none;
font-weight: bold;
font-size: 0.8em;
}

li.widget li ,li.widget li:first-child  {
margin-bottom: 0.8em;
}

li.widget li a:hover {
font-family: arial;
text-decoration: underline;
}

The demo page

Posted in technology, wordpress | Tagged , , , , | 3 Comments

How to display Widgets inside posts and pages

I was faced the need to be able to place extra manageable content inside a wordpress page’s core content… and without an existing plugin available to do this I thought I’d write one of my own.

The output was the Widgets on Pages wordpress plugin which is at time of writing at version 0.0.4. The plugin basically allows the author to add a shortcode to their wordpress page or post which will then add the content of a predefined Widget area (or sidebar) at that point in the post/page

Widgets on Pages Options

The plugin approach allows the user to add a lot of extra control to their wordpress sites without the need for any coding or markup skills (PHP, MySQL, HTML etc).

UPDATE: In version 0.0.4 you are able to define an unlimited number of separate sidebars and call these all separately within the wordpress content.

Posted in technology, wordpress | Tagged , , , | 16 Comments

Too Helpful

I’d be the first to admit that I’m no “deisgn guru” and that when you come from a developers back ground trying to work out how users will use a system (be it an e-Commerce web site or a Twitter Client) it is always tough to work out just how the users will go about their business. There is a real hurdle to overcome when trying to use a system as a user rather than as someone who’s deisgned (in terms of workflow at least) and built it.

It’s easy to get into the kind of mindset of “well of course you then click X to get to Y” which is why usability testing is really important. We have to remember that web sites will be used (hopefully) all the time by people who’ve never been there before and hence things should be logical and flow… and when this is not always so simple provide enough guidance to aid the user.

Sometimes folks can go too far… and in fact confuse the user. Take a look at the screenshot below and think about where you’d instinctively click to go to the next page. Bear in mind that it’s likely you’ve just scanned down the text (although I’ve blurred it here but please pretend that the text might be semi-important).

Too helpful?

I would think that most people would click the right facing arrow at the centre bottom of the page, bearing in mind that they’ve just scanned the text above. Yup, the one with the word continue written next to it. Either that or they also see the button at the top right and then may think “Oh, which one do I press and does it matter at all?”. Sadly you’ve got at best a 50% chance of going nowhere. In fact these arrows at the bas of the page are not buttons at all but simply ‘helpful’ instructions about the arrows that will appear at the top right corner of each page.

So what’s the lesson here? Testing is important… and it’s no good just testing something yourself as you know what and how a system is meant to work.

Posted in design, technology | Tagged , | Leave a comment

Cupcake – First Impressions on the Android Update

This morning I received the Cupcake update for my UK T-mobile G1… and so far I have to say that it’s a great improvement… in terms not just of niggles I had with the last version but also in reference to some of the new tweaks and features that have now been added.

Android Cupcake

Android Cupcake

The update took no more than 10 minutes during which my phone was unusable. There was, however, good visual feedback letting me know at least that something was going on. Straight after the G1 had rebooted I clicked on the ‘ToggleBlu’ application icon to switch the Bluetooth off (it is on by default… I’m not sure as to why but perhaps I’m in the minority here) and sadly it failed. I started to dread that the update would break all my downloaded apps… things were not looking too bright. So I started playing with the other Market downloads to see just how they’d react to the new release of the OS.

From that point on everything seemed a great change; all the other applications whether installed by default (contacts, gmail, etc) or third party software all seemed to run fine… and some with some nice new features.

Here is a list of just a few of the key things that I’ve noticed.

  • Faster scrolling – perhaps it’s because I’m excited but I do seem to notice an improvement in the scrolling.
  • Batch options in Gmail – you are now able to bulk archive, set labels, etc,
  • Auto rotate – without any additional software the orientation of the screen can be automated
  • Screen animations – some nice ice candy when moving between screens
  • Calendar – more control over events and a better “agenda” view
  • Improved Camera capture – seems much quicker and has a better interface/interaction with gallery
  • Video playback/capture support – I have only played with this briefly but seems pretty good and also supports audio.
  • Browser – 1 click zoom to 1:1 option, a “most visited” tab in the bookmarks page
  • On screen keyboard – although I really love having a “proper” qwerty keyboard I think for quick SMS creation this may come in useful.

All in all I have to say I’m pleased so far… I’m also excited about the coming of 3rd party widgets too so to sum up… my phone just keeps improving!

UPDATE (08/05/09): Kudos to  Andrew Schwimmer who had a fix for the ToogleBlu app out yesterday. Also just noticed a nifty “double tap to unlock” feature when on a call. Looks like “Shake Awake” is no longer needed.

Posted in Uncategorized | 1 Comment

My 1st Plugin is Released

Wordpress.org

Wordpress.org

As part of my work for Gingerbread Design I have just released my first WordPress plugin into the wild. The plugin provides bulk functionality to help manage eCommerce web sites/stores. Details of the plugin can be found on the official plugin homepage and of course can be downloaded from the WordPress.org plugin directory.

Please, please try this out if you use the WP e-Commerce plugin in your own web site/store and let me know which other bulk features may be of interest and most use to you.

Posted in technology | Tagged , | 11 Comments