Responsive Design with WordPress (WCPHX)

Post on 12-May-2015

1.726 views 3 download

Tags:

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.

Transcript of Responsive Design with WordPress (WCPHX)

Responsive Design with WordPress

Joe Casabona

casabona.org@jcasabon

a

Who Am I?*

2

*Besides a handsome devil

3

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

4

Why?

5

How?

6

❖EM-Based Breakpoints

❖Breakpoints based on Content

❖Consider Connection Speeds

RESS

7

❖My Plugin: rwdwp.com/22

❖ Jesse's: rwdwp.com/35

WURFL Database

8

❖Device Detection

❖Feature Detection

❖Open Source

❖Scientia Mobile

Scientia Mobile

9 rwdwp.com/20

wp_is_mobile()

10

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());

12

if(ISMOBILE){//display one way

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

}

Always ask what’s best for

the users!

13

Responsive Workflow

14

❖Sketch

❖Code

❖Test

❖Repeat

Mobile First!

15

I use the web completely differently on mobile devices.

- No One

16

Design in the Browser

17

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)

Expand Out!

19bradfrostweb.com

Style Tiles

20 styletil.es

General Notes for Page Weight

21

Make it Work with

WordPress

22

Navigation

23

❖Do Nothing

❖Hide n' Cry

❖ Jump to

❖Select Box

❖Responsive Nav

❖Off-Canvas

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>

25

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

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

</nav><?php } ?>

Comments!

26

❖ Incremental Loading

❖Pagination

❖Separate Page

Responsive Images

27

picturefill.js

28

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>

30

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

}

Images Are Hard!

31

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

Testing

33

❖ 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

❖ Broadband (wired or wifi connection)

❖ 4G (on multiple carriers if possible)

❖ 3G (on multiple carriers if possible)

❖ 4G and 3G while traveling

Connectivity

35

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

❖ Chrome on Android and iOS

❖ Mobile Opera

❖ Dolphin

❖ Mobile Firefox

Browsers!

36

Questions?

37

Discount Code: RWDWP with you order from peachpit.com

Slides will be at casabona.org/events