37
Responsive Design with WordPress Joe Casabona casabona. org @jcasabon a

Responsive Design with WordPress (WCPHX)

Embed Size (px)

DESCRIPTION

I will go over some of the core content from my book, Responsive Design with WordPress, which teaches you how to leverage WordPress to get the most out of responsive design, implement best practices, automate important processes, and make your life easier overall.

Citation preview

Page 1: Responsive Design with WordPress (WCPHX)

Responsive Design with WordPress

Joe Casabona

casabona.org@jcasabon

a

Page 2: Responsive Design with WordPress (WCPHX)

Who Am I?*

2

*Besides a handsome devil

Page 3: Responsive Design with WordPress (WCPHX)

3

Page 4: Responsive Design with WordPress (WCPHX)

Responsive Web Design: The idea that your website will automatically adapt to the device it's being viewed on.

4

Page 5: Responsive Design with WordPress (WCPHX)

Why?

5

Page 6: Responsive Design with WordPress (WCPHX)

How?

6

❖EM-Based Breakpoints

❖Breakpoints based on Content

❖Consider Connection Speeds

Page 7: Responsive Design with WordPress (WCPHX)

RESS

7

❖My Plugin: rwdwp.com/22

❖ Jesse's: rwdwp.com/35

Page 8: Responsive Design with WordPress (WCPHX)

WURFL Database

8

❖Device Detection

❖Feature Detection

❖Open Source

❖Scientia Mobile

Page 9: Responsive Design with WordPress (WCPHX)

Scientia Mobile

9 rwdwp.com/20

Page 10: Responsive Design with WordPress (WCPHX)

wp_is_mobile()

10

Page 11: Responsive Design with WordPress (WCPHX)

11

function jlc_is_mobile_device($apikey){try{

$config = new WurflCloud_Client_Config(); $config->api_key = $apikey; $client = new

WurflCloud_Client_Client($config); $client->detectDevice();

return $client->getDeviceCapability('is_wireless_device');

}catch (Exception $e){return wp_is_mobile();

}}

define( 'ISMOBILE', jlc_is_mobile_device());

Page 12: Responsive Design with WordPress (WCPHX)

12

if(ISMOBILE){//display one way

}else{ //not mobile device//display different way

}

Page 13: Responsive Design with WordPress (WCPHX)

Always ask what’s best for

the users!

13

Page 14: Responsive Design with WordPress (WCPHX)

Responsive Workflow

14

❖Sketch

❖Code

❖Test

❖Repeat

Page 15: Responsive Design with WordPress (WCPHX)

Mobile First!

15

Page 16: Responsive Design with WordPress (WCPHX)

I use the web completely differently on mobile devices.

- No One

16

Page 17: Responsive Design with WordPress (WCPHX)

Design in the Browser

17

Page 18: Responsive Design with WordPress (WCPHX)

The next era in designing for the web is a more advanced, mature and intelligent one. It’s about streamlining, semantics, great markup, responsive or fluid design, great typography, web fonts, content first, rapid prototyping and advanced javascript. My argument is that html, CSS and the browser tools we need have all advanced us past the point of needing Photoshop.

18

- Josh Long (rwdwp.com/94)

Page 19: Responsive Design with WordPress (WCPHX)

Expand Out!

19bradfrostweb.com

Page 20: Responsive Design with WordPress (WCPHX)

Style Tiles

20 styletil.es

Page 21: Responsive Design with WordPress (WCPHX)

General Notes for Page Weight

21

Page 22: Responsive Design with WordPress (WCPHX)

Make it Work with

WordPress

22

Page 23: Responsive Design with WordPress (WCPHX)

Navigation

23

❖Do Nothing

❖Hide n' Cry

❖ Jump to

❖Select Box

❖Responsive Nav

❖Off-Canvas

Page 24: Responsive Design with WordPress (WCPHX)

24

<nav id=”main”> <?php

if(!ISMOBILE){wp_nav_menu( array('menu' => ‘Main',

'container_id' => 'top-menu')); }else{ echo '<a href=”#footernav”>Jump to Nav</a>';

}

?>

</nav>

Page 25: Responsive Design with WordPress (WCPHX)

25

<?php if(ISMOBILE){ ?><nav id=“footer-nav”>

<?php wp_nav_menu( array('menu' => ‘Main’)); ?>

</nav><?php } ?>

Page 26: Responsive Design with WordPress (WCPHX)

Comments!

26

❖ Incremental Loading

❖Pagination

❖Separate Page

Page 27: Responsive Design with WordPress (WCPHX)

Responsive Images

27

Page 28: Responsive Design with WordPress (WCPHX)

picturefill.js

28

Page 29: Responsive Design with WordPress (WCPHX)

29

<span data-picture data-alt="A photo of a thing"> <span data-src="small.jpg"></span> <span data-src="medium.jpg" data-media="(min-width: 400px)"></span> <span data-src="large.jpg" data-media="(min-width: 800px)"></span> <span data-src="extralarge.jpg" data-media="(min-width: 1000px)"></span>

<noscript> <img src="small.jpg" alt="A giant stone face at The Bayon temple in Angkor Thom, Cambodia"> </noscript> </span>

Page 30: Responsive Design with WordPress (WCPHX)

30

$(function(){ $(“.post img).removeAttr(“width”).removeAttribute(“height”);

}

Page 31: Responsive Design with WordPress (WCPHX)

Images Are Hard!

31

Page 32: Responsive Design with WordPress (WCPHX)

32

@media(-webkit-min-device-pixel-ratio: 2),(min-resolution: 192dpi) { /* Retina-specific stuff here */}

<span data-src="retina.jpg" data-media="(-webkit-min-device-pixel-ratio: 2) and (min-resolution: 192dpi)"></span>

rwdwp.com/95

Page 33: Responsive Design with WordPress (WCPHX)

Testing

33

Page 34: Responsive Design with WordPress (WCPHX)

❖ iPhone 4, 5

❖ iPad 2 or new iPad

❖ Android 4.0+ Phones: Galaxy Nexus, Galaxy Note II, S3 or S4, Droid Incredible (one of them), Droid DNA or Razor Maxx

❖ Android pre-4.0 Phones: Moto DroidX, Evo4G

❖ Android Tablets: Nexus 7, 10, Samsung Galaxy Note 10, Galaxy Tab 8.9, Kindle Fire, Moto XOOM

❖ At least one Blackberry (Q10, Z10)

❖ At least one Windows Phone (Lumia or HTC 8x)

❖ For fun: a Kindle or some other eReader

Devices

34

Page 35: Responsive Design with WordPress (WCPHX)

❖ Broadband (wired or wifi connection)

❖ 4G (on multiple carriers if possible)

❖ 3G (on multiple carriers if possible)

❖ 4G and 3G while traveling

Connectivity

35

Page 36: Responsive Design with WordPress (WCPHX)

❖ The device’s native browser (Safari, Browser, etc)

❖ Chrome on Android and iOS

❖ Mobile Opera

❖ Dolphin

❖ Mobile Firefox

Browsers!

36

Page 37: Responsive Design with WordPress (WCPHX)

Questions?

37

Discount Code: RWDWP with you order from peachpit.com

Slides will be at casabona.org/events