Lime Blast » Responsive Web Design http://limeblast.co.uk The virtual home of Web developer Daniel Hollands, the place to be if you're looking for articles and tutorials (and rants) on all aspects of the World Wide Web. Wed, 14 Oct 2015 13:13:21 +0000 en-US hourly 1 http://wordpress.org/?v=3.9 WordPress Theme – Responsive /2012/06/wordpress-theme-responsive/ /2012/06/wordpress-theme-responsive/#comments Thu, 07 Jun 2012 16:04:57 +0000 /?p=482

Related posts:

  1. Images in responsive WordPress Web sitesFor the past couple of weeks I’ve been learning how to build responsive Web sites, a process that is simple in principle, but complex in practice once you get down to the nitty-gritty. As I want to use this blog as......
  2. Scrap it and start againAfter spending almost all of my spare time during the last four weeks working on designing and building the Lime Blast site, I had gotten to a point on Saturday morning where all I had to do was fix the......
  3. CSS CrushAlthough there is a lot of love for CSS preprocessors such as LESS and SASS, both of which seem to work very well, I wanted to take a moment to talk about a slightly different alternative, the PHP-based CSS Crush. Much......
]]>
As some of you may know, I’m a keen gamer. I have been for most of my life – certainly for as long as I’ve had access to a PC at any rate – and I was pretty much hooked for life once I got a SNES (Zelda 4EVA).

What you may not know is that I’m also the co-founder of a gaming clan/guild called Fight Club Monkey.

Fight Club Monkey?

What started as a semi-serious attempt at competing in an Urban Terror gaming league with some friends, resulted in us all realising that we’re were not actually very good at the game, and that we had far more fun messing about than trying to win.

(Most of our clan nights ended with the in-game gravity on the server being turned down, allowing us to pretend as if we were shooting terrorists on the moon.)

Although the clan lasted for a couple of years, and we ventured into new games as they were released, eventually it become less and less important as we grew up, got jobs and/or went to university.

Since late last year, however, FCM has made a return, not as a clan or guild per se, but rather as a group of friends who like to get together to play games once in a while.

Getting to the point

I mention all of this simply as a preface to the announcement that on Friday I relaunched the Fight Club Monkey website based on a fantastic WordPress theme called Responsive by ThemeID.

I’m often quite fussy about the themes I use in my WordPress projects – most of the time I prefer to build a theme using something like Roots Theme (although, not so much now it’s gone Bootstrap exclusive) or the newly discovered _s base theme.

On this occasion, however, I had limited time to work on the project, so was more interested in finding something that worked out the box, which I could then expand using child themes. Being responsive was never crucial to the project, but would have been a nice perk.

During my research I came across themes such as Hybridside and Revova, both of which I think were attractive options, but Responsive blew them both out of the water with its functionality.

What makes it good then?

Responsive theme

We’re moving into an age where more and more people are using mobile and tablet devices to access the web, and any sites that don’t keep up with the changing face of technology will get left behind.

There are some features that don’t work quite as well responsivly as I would like (such as the very top and very bottom navigation bars being far too small on phones), but these issues should fixable with a few CSS tweaks.

Child theme support

Unlike some free themes I’ve used in the past, the development and improvement of Responsive seems quite active (just a day after launching the site I saw there was a theme update waiting for me), so by having good child theme support, you’re free to go in and make your own customisations and enhancements, while retaining the ability to easily upgrade to the latest release.

Theme options

Baked into the theme are a number of settings which can be controlled within the WordPress administration area. These include being able to set-up links to popular social networking sites (such as Twitter, Facebook and even Pinterest & Instagram), adding your Google/Bing/Yahoo webmaster verification strings, as well as whatever statical tracking code you use, and an area for a small amount of custom CSS.

Also impressive is the easy way in which you can customise the elements which exist on the homepage, with the main call to action area being controlled via its own interface, and the three areas below that being widgetized (is that even a word?) allowing you to put in whatever widgets you want.

The theme also supports ten page templates, allowing you quite a lot of flexibility in how you want to display your content of your site.

Conclusion

All in all, I’m very impressed by the Responsive theme. It has ticked all the boxes I needed for the FCM site, and am looking forward to using its child theme support to enhance it further. Visit the Responsive theme website.

]]>
/2012/06/wordpress-theme-responsive/feed/ 0
Images in responsive WordPress Web sites /2012/02/images-in-responsive-wordpress-web-sites/ /2012/02/images-in-responsive-wordpress-web-sites/#comments Tue, 28 Feb 2012 13:35:35 +0000 /?p=183

Related posts:

  1. Scrap it and start againAfter spending almost all of my spare time during the last four weeks working on designing and building the Lime Blast site, I had gotten to a point on Saturday morning where all I had to do was fix the......
  2. I love you Jose Diaz-GonzalezThis is a very quick post to thank Jose Diaz-Gonzalez for the Upload behaviour he wrote for CakePHP. I needed a way of uploading multiple images in the admin area of the Chameleon Photography site. During my Cake 1.3 days,......
  3. Rotten to the CoreI don’t know if there is a term for what I am – Applephobic maybe – but I hate Apple. I’m about as PC as PC can get (and I’m not talking about being Politically Correct). In my opinion, the......
]]>
For the past couple of weeks I’ve been learning how to build responsive Web sites, a process that is simple in principle, but complex in practice once you get down to the nitty-gritty.

As I want to use this blog as a means for sharing knowledge and information that other developers might find useful, allow me to present my first such post, designed to solve the problem with how to display images within WordPress posts and pages on responsive Web sites.

What is a responsive Web site?

For anyone unfamiliar with thm, responsive Web sites are sites that adapt and change their layout to fit the size of the device they’re viewed on.

This site, for example, is a responsive Web site, and employs responsive techniques which enables it to switch between three different layouts:

  • Desktop – which has two main columns.
  • Tablet – where the right column drops below the main content, and the width of the site drops.
  • Mobile – everything is in a single column which spans the entire width of the device.

If you’re using a desktop computer, try resizing your browser and you’ll see the site switch between the three layouts as the window gets smaller.

As I’m sure you can imagine, due to the fact this requires designing and building multiple layouts, building a responsive site is hard work, especially once you come up against the issue of trying to display the same content on an ever decreasing screen size.

Responsive images

Anyway… One issue that I encountered while building this site was that of images embedded into posts and pages.

I had already designed both the desktop and tablet layouts to have the same width content area, meaning I can use the alignment options offered by WordPress, and know exactly how they’re going to look on two of my three layouts.

But what about the mobile layout? This is a bit more difficult to handle as the width of the device is variable. There had to be a simple way of handing this issue?

Requirements

The first thing I wanted was to remove any left or right alignments of images in the mobile layout, and instead force them onto their own line with a centre alignment. This is because on a screen that is potentially no more than 480 pixels wide, the last thing you want is a 300 pixel image sat to the right of the content you’re trying to read.

I also wanted to make sure that the images on the mobile layout are displayed at an intelligent size. For example, images that are smaller than the width of the browser should display at their native resolution, but images larger than the width of the browser should resize down to fit.

Finally, I needs to use Mobile First techniques to make the site as accessible as possible.

Solution

Below is the code that I’ve produced to solve these issues. It is based on the required WordPress Generated Classes CSS, but modifies it to allow for the behaviour described in the requirements above.

I’ve tested it as much as I can, and so far as I can tell, it works exactly as intended, but if you can find any problems with it, or can offer any suggestions on how to improve it, please let me know.

/* ===================================
   WordPress Images
   =================================== */

/*
 * Mobile First
 */
a img.aligncenter
{
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.wp-caption,
figure
{
    background: #fff;
    border: 1px solid #f0f0f0;
    max-width: 96%;
    text-align: center;
    padding: 5px 5px 10px;
}

.wp-caption p.wp-caption-text,
figcaption
{
    font-size: 11px;
    line-height: 17px;
    margin: 0;
    padding: 10px 4px 0;
}

img.alignright,
img.alignleft,
img.aligncenter
{
    float: none;
    max-width: 100%;
    height: auto;
    margin: 1em auto;
    display: block;
}
.wp-caption img,
.wp-caption.alignright img,
.wp-caption.alignleft img,
.wp-caption.aligncenter img,
figure img,
figure.alignright img,
figure.alignleft img,
figure.aligncenter img
{
    margin: 0 auto;
    max-width: 100%;
    height: auto;
}
.wp-caption.alignright,
.wp-caption.alignleft,
.wp-caption.aligncenter,
figure.alignright,
figure.alignleft,
figure.aligncenter
{
    float: none;
    max-width: 100% !important;
    height: auto;
    margin: 0 auto;
}

/*
 * Tablet and up
*/

@media only screen and (min-width: 768px) {

    .wp-caption.alignright,
    figure.alignright
    {
        margin: 5px 0 20px 20px;
    }

    .wp-caption img,
    figure img
    {
        border: 0 none;
        height: auto;
        max-width: 98.5%;
        width: auto;
        margin: 0;
        padding: 0;
    }

    .aligncenter,
    div.aligncenter,
    .aligncenter,
	figure.aligncenter
    {
        display: block;
        margin: 5px auto;
    }

    .alignright,
    a img.alignright
    {
        float: right !important;
        margin: 5px 0 17px 17px !important;
    }

    .alignleft,
    a img.alignleft
    {
        float: left !important;
        margin: 5px 17px 17px 0 !important;
    }

}

Figures

You may have noticed the above code featured the new HTML5 figure and figcaption tags. Although WordPress doesn’t automatically support the figure tag, it is possible to have WordPress use figure in place of its own caption solution by adding the following to your theme’s functions.php file (which was adapted from code in this article):

add_shortcode('wp_caption', 'twentyten_img_caption_shortcode');
add_shortcode('caption', 'twentyten_img_caption_shortcode');

function twentyten_img_caption_shortcode($attr, $content = null)
{
	$options = array(
		'id' => '',
		'align' => 'alignnone',
		'width' => '',
		'caption' => ''
	);

	extract(shortcode_atts($options, $attr));

	if (1 > (int) $width || empty($caption))
	{
		return $content;
	}

	if ($id)
	{
		$idtag = 'id="' . esc_attr($id) . '" ';
	}

	return '<figure ' . $idtag . 'aria-describedby="figcaption_' . $id . '" style="width: ' . (10 + (int) $width) . 'px" class="'.$align.'">'. do_shortcode($content) . '<figcaption id="figcaption_' . $id . '">' . $caption . '</figcaption></figure>';
}
]]>
/2012/02/images-in-responsive-wordpress-web-sites/feed/ 0