going responsive with wordpress

21
Going Responsive with WordPress @jrcryer jamescryer.com

Upload: james-cryer

Post on 09-May-2015

639 views

Category:

Technology


0 download

DESCRIPTION

Responsive Web Design (RWD) with WordPress, tools and frameworks to make the effort easy.

TRANSCRIPT

Page 1: Going Responsive with WordPress

Going Responsivewith WordPress

@jrcryerjamescryer.com

Page 2: Going Responsive with WordPress

Responsive Web Design: Definition

•Flexible grids

•Flexible media (images and video)

•Media queries

A responsive design is composed of three distinct parts:

Making sites device agnostic

Page 3: Going Responsive with WordPress
Page 4: Going Responsive with WordPress

Flexible Grids

•Use formula:

•Example

•Think in pixels percentages

Flexible grids expand and contract to fit the context in which they are viewed

target / context = result

900 / 960 = 0.9375

Page 5: Going Responsive with WordPress

Flexible Grids

#sidebar { width: 33.333333333333%; }

Page 6: Going Responsive with WordPress

Flexible Media

•Technique:

•Internet Explorer 6 or below:

Add constraints to prevent images overflowing their containers

img { max-width: 100%; height: auto;}

img { width: 100%;}

Page 7: Going Responsive with WordPress

Flexible Media (cont...)

•Technique:

•Also applies to <video />, <embed /> and <object />

Use of overflow, instead of scaling

.container { overflow: hidden;}

img { max-width: auto;}

Page 8: Going Responsive with WordPress

Media Queries

•Example:

“A robust mechanism for identifying not only types of media, but inspection of physical characteristics of the devices”

@media screen and (min-width: 1024px) { body { font-size: 100%; }}

<link href=”desktop.css” rel=”stylesheet” media=”screen and (min-width: 1024px)” />

Page 9: Going Responsive with WordPress

Media Queries

• device-width

• device-height

• width

• height

• orientation

• and more...

Available features:

Page 10: Going Responsive with WordPress

Media Queries

•Example:

Setting viewport size

<meta name=”viewport” content=”initial-scale=1.0, width=device-width” />

Page 11: Going Responsive with WordPress

Breakpoints

@media screen and (min-width: 480px) { ...}

@media screen and (min-width: 600px) { ...}

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

@media screen and (min-width: 1024px) { ...}

Page 12: Going Responsive with WordPress

Side note...

•Icon fonts

•SVG for logos with PNG fallback

•Web fonts

Also consider:

Page 13: Going Responsive with WordPress

Responsive Design in Wordpress

Page 14: Going Responsive with WordPress

Frameworks

•Bones

•Reverie

•Skeleton

Available frameworks to get started:

Alternatively, roll your own...

Page 15: Going Responsive with WordPress

Flexible Media

/** * RESPONSIVE IMAGE FUNCTIONS */ add_filter( 'post_thumbnail_html', 'remove_thumbnail_dimensions', 10 );add_filter( 'image_send_to_editor', 'remove_thumbnail_dimensions', 10 ); function remove_thumbnail_dimensions( $html ) { return preg_replace( '/(width|height)=\"\d*\"\s/', "", $html );}

Preventing WordPress from adding width and height:

Page 16: Going Responsive with WordPress

Going it alone...

•Take a mobile first approach

•Use a CSS preprocessor - LESS or SASS

•Start simple

Page 17: Going Responsive with WordPress

Responsive Plugins

•Responsive Video Light

•SlideDeck 2

•Respond.js

•Simple Responsive Images

•Smooth Slider

Page 18: Going Responsive with WordPress

Other tools

•Twitter’s Bootstrap

•ZURB’s Foundation

•IcoMoon

•Fontello

•Modernizr

Page 19: Going Responsive with WordPress

Live Demo

LIVE DEMO

Page 20: Going Responsive with WordPress

Questions?

Examples from today

https://gist.github.com/jrcryer

Page 21: Going Responsive with WordPress

Further info?