SlideShare a Scribd company logo
Responsive Web Design
tehnike u WordPressu
Igor Benić WP Meetup Zagreb 19.09
Sadržaj
• O meni
• Što je RWD?
• Izrada RWD-a
• Slike u RWD-u
• WordPress i RWD
• Slike u WordPress-u
• WordPress Mobile
• Pitanja
O meni
• Front End Developer @ Multilink
• Co-founder – www.lakotuts.com
• PSD -> PHP
• Autor knjige: WordPress na Bootstrap-u 3.x
O meni
• Bootstrap 3
• Izrada osnovne i naprednih tema
• Customizer API
• Settings API
• AJAX
http://leanpub.com/wpb3
Što je RWD?
• Stranica (sadržaj) se prilagođava ekranu
– Točke izmjene
• Vrste RWD-a
– Responsive
– Adaptive
• Sadržaj
• Brzina
Izrada RWD-a
• Mobile First
• Desktop First
• Korištenje Alata
• CSS od nule
• Korištenje Frameworka
Načini izrade - Framework
• Bootstrap 3
• Foundation
• Skeleton
• Gumby
• Mnogi drugi
Slike u RWD-u
• Nisu jednostavne
– Servirati samo potrebnu sliku
– Paziti i na Retina ekrane
• Moguća rješenja
– Picturefill 2.0
– BttrLazyLoading
Slike u RWD-u – PictureFill 2.0
<picture>
<!--[if IE 9]><video style="display: none;"><![endif]-->
<source srcset="examples/images/extralarge.jpg" media="(min-
width: 1000px)">
<source srcset="examples/images/large.jpg" media="(min-width:
800px)">
<source srcset="examples/images/large@2.jpg" media="(min-
width: 800px) and (-webkit-min-device-pixel-ratio: 2)">
<!--[if IE 9]></video><![endif]-->
<img srcset="examples/images/medium.jpg" alt="A giant stone
face at The Bayon temple in Angkor Thom, Cambodia">
</picture>
Slike u RWD-u – BttrLazyLoading
<img id="yourImageId" class="bttrlazyloading"
data-bttrlazyloading-xs-src="img/768x200.gif"
data-bttrlazyloading-xs-width="768"
data-bttrlazyloading-xs-height="200"
data-bttrlazyloading-sm-src="img/345x250.gif"
data-bttrlazyloading-sm-width="345"
data-bttrlazyloading-sm-height="250"
data-bttrlazyloading-md-src="img/455x350.gif"
data-bttrlazyloading-md-width="455"
data-bttrlazyloading-md-height="350" d
data-bttrlazyloading-lg-src="img/360x300.gif"
data-bttrlazyloading-lg-width="360"
data-bttrlazyloading-lg-height="300" />
WordPress i RWD
RESS
Pružanje sadržaja ovisno o uređaju
Prilagodba sadržaja na serveru
Slike u WordPress-u
• Različite verzije za istu sliku
– add_image_size(“verzija”, širina, visina, [true |
false]);
• add_filter(“post_thumbnail”,
funkcija_za_promjenu);
Slike u WordPress-u - Thumbnailovifunction wpb3_thumbnail_html($html, $post_id, $aid, $sizeThumb, $attr){
if($sizeThumb == "slika-clanka"){
$sizes = array('slika-clanka‘, 'slika-clanka-md‘, 'slika-clanka-sm‘, 'slika-clanka-xs’);
$img = "<img class='bttrLazyLoading img-responsive' alt='".get_the_title()."'";
$sizeBttr = "";
$width = "";
$height = "";
$aid = (!$aid) ? get_post_thumbnail_id() : $aid;
foreach ( $sizes as $size ) {
$url = wp_get_attachment_image_src( $aid, $size );
switch ($size) {
case 'slika-clanka':
$sizeBttr = "lg";
$width = "750";
$height= "353";
break;
...
}
$img .= " data-bttrlazyloading-".$sizeBttr."-src='". $url[0] ."' ";
$img .= " data-bttrlazyloading-".$sizeBttr."-width='". $width ."' ";
$img .= " data-bttrlazyloading-".$sizeBttr."-height='". $height ."' ";
}
$img .= " />";
return $img;
}
return $html;
}
add_filter(
'post_thumbnail_html',
'wpb3_thumbnail_html', 10, 5);
Slike u WordPress-u - Content
• Filtrirati slike prilikom ispisa ili obrisati (na mobitelima)
– add_filter(‘the_content’, ‘funkcija za filtriranje slika’)
• CSS:
– .post img {max-width:100%;height:auto;}
function slike_u_content() {
global $post;
$html = preg_replace_callback( '#(<imgs[^>]*src)="([^"]+)"#', "callback_img",
get_the_content($post->ID) );
return $html;
}
function callback_img($match) {
list(, $img, $src) = $match;
$url = get_stylesheet_directory_uri().'/img_placeholder.gif';
return "$img="$url" data-href="$src" ";
}
Slike u WordPress-u - LakoTuts
• Filtrirati slike prilikom ispisa
– add_filter(‘the_content’, ‘funkcija za filtriranje slika’)
• CSS:
– .post img {max-width:100%;height:auto;}
$attachment_id = lakotuts_get_attachment_id_from_url($header_image);
$image480 = wp_get_attachment_image_src( $attachment_id, 'image480' );
$image768 = wp_get_attachment_image_src( $attachment_id, 'image768' );
$image1024 = wp_get_attachment_image_src( $attachment_id, 'image1024' );
$image1920 = wp_get_attachment_image_src( $attachment_id, 'image1920' );
echo ‘ #masthead { background-image: url(''. $image768[0] .''); } ';
echo '@media (min-width:768px) { #masthead { background-image: url(''. $image768[0] .''); }}';
echo '@media (min-width:1024px) { #masthead { background-image: url(''. $image1024[0] .''); }}';
echo '@media (min-width:1200px) { #masthead { background-image: url(''. $image1920[0] .''); }}';
WordPress Mobile
• wp_mobile()
• WURFL baza podataka
• github.com/jcasabona/wp-ress/
WordPress Mobile
function wpr_detect_mobile_device(){
try{
$config = new WurflCloud_Client_Config();
$config->api_key = WPR_API_KEY;
$client = new WurflCloud_Client_Client($config);
$client->detectDevice();
return $client->getDeviceCapability('is_wireless_device');
}
catch (Exception $e){
return wp_is_mobile();
}
}
define('WPR_IS_MOBILE', wpr_detect_mobile_device());
WordPress Mobile
• Izbornici za Desktop i Mobitele/Tablete
– Izbjegnut dvostruki HTML sadržaj
• Prikaz pojedinog sadržaja samo na zahtjev
– Komentari
– Sidebar
Pitanja
?

More Related Content

PDF
Responsive WordPress workflow
PDF
Frontend django, Django Web 前端探索
PDF
Css sprite_maker-1
PPTX
CT presentatie JQuery 7.12.11
KEY
Decoding developers
KEY
All About Sammy
PPTX
Managing responsive websites with css preprocessors.
PPTX
Responsive WordPress workflow
Frontend django, Django Web 前端探索
Css sprite_maker-1
CT presentatie JQuery 7.12.11
Decoding developers
All About Sammy
Managing responsive websites with css preprocessors.

What's hot (20)

KEY
Be German About Your Frontend
PDF
Front-end Rails-приложений приложений, основанный на БЭМ
KEY
Dr. Strangelove or: How I learned to stop worrying and love HTML, CSS and Jav...
PDF
Whirlwind Tour of SVG (plus RaphaelJS)
PDF
dojo.Patterns
PPT
Yuihacku iitd-sumana
PPTX
PDF
AngularJS: The Bridge Between Today and Tomorrow's Web (Todd Motto)
PDF
Tide - The missing web framework
PDF
Fundamental JQuery
PDF
Best Practices for Embedded UA - WritersUA 2012, Scott DeLoach, ClickStart
PPT
Sadielai10x10presentation
PDF
Thinkin' Tags - Rapid Prototyping of CSS Layouts
PDF
Introduction to Web Design, Week 1
PDF
Real World Web components
KEY
An in-depth look at jQuery UI
PDF
WordPress Theme Workshop: CSS/JS
PDF
Front End Tooling and Performance - Codeaholics HK 2015
DOCX
Sami world travel
PDF
JavaScript the Smart Way - Getting Started with jQuery
Be German About Your Frontend
Front-end Rails-приложений приложений, основанный на БЭМ
Dr. Strangelove or: How I learned to stop worrying and love HTML, CSS and Jav...
Whirlwind Tour of SVG (plus RaphaelJS)
dojo.Patterns
Yuihacku iitd-sumana
AngularJS: The Bridge Between Today and Tomorrow's Web (Todd Motto)
Tide - The missing web framework
Fundamental JQuery
Best Practices for Embedded UA - WritersUA 2012, Scott DeLoach, ClickStart
Sadielai10x10presentation
Thinkin' Tags - Rapid Prototyping of CSS Layouts
Introduction to Web Design, Week 1
Real World Web components
An in-depth look at jQuery UI
WordPress Theme Workshop: CSS/JS
Front End Tooling and Performance - Codeaholics HK 2015
Sami world travel
JavaScript the Smart Way - Getting Started with jQuery
Ad

Viewers also liked (12)

PDF
Instalacija i podešavanje word press bloga
PPT
WordPress za početnike
ODP
Šta je Bootstrap?
PPT
Projektovanje web aplikacija
PDF
WordPress teme za početnike - uvod u Theme Development
PPTX
Wordpress - Sistem za upravljanje sadržajem na webu
PDF
Profiling php5 to php7
PPT
Starenje softvera
PDF
Uvod u funkcionalno programiranje
PPT
Refaktorisanje
PPT
Uvod u objektno orijentisano programiranje i C++
PPT
Uvod u softversko inženjerstvo
Instalacija i podešavanje word press bloga
WordPress za početnike
Šta je Bootstrap?
Projektovanje web aplikacija
WordPress teme za početnike - uvod u Theme Development
Wordpress - Sistem za upravljanje sadržajem na webu
Profiling php5 to php7
Starenje softvera
Uvod u funkcionalno programiranje
Refaktorisanje
Uvod u objektno orijentisano programiranje i C++
Uvod u softversko inženjerstvo
Ad

Similar to Responsive Web Design tehnike u WordPress-u (20)

PDF
以Vue開發電子商務網站
架構與眉角
PPTX
Word Press As A Cms
PDF
Death of a Themer
PDF
You're Doing it Wrong - WordCamp Atlanta
PDF
建立前端開發團隊 - 2011 中華電信訓練所版
PDF
RESS – Responsive Webdesign and Server Side Components
PDF
CSS and image optimization
KEY
WordPress Developers Israel Meetup #1
KEY
[Coscup 2012] JavascriptMVC
PDF
bcgr3-jquery
PDF
bcgr3-jquery
KEY
Bringing sexy back to CSS: SASS/SCSS, LESS and Compass
PDF
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
PPTX
From PSD to WordPress Theme: Bringing designs to life
KEY
Rails3 asset-pipeline
PDF
125 고성능 web view-deview 2013 발표 자료_공유용
DOCX
Membuat slide show pada posting
PDF
WordPress as the Backbone(.js)
PDF
Mobile themes, QR codes, and shortURLs
KEY
Drupal as a web framework
以Vue開發電子商務網站
架構與眉角
Word Press As A Cms
Death of a Themer
You're Doing it Wrong - WordCamp Atlanta
建立前端開發團隊 - 2011 中華電信訓練所版
RESS – Responsive Webdesign and Server Side Components
CSS and image optimization
WordPress Developers Israel Meetup #1
[Coscup 2012] JavascriptMVC
bcgr3-jquery
bcgr3-jquery
Bringing sexy back to CSS: SASS/SCSS, LESS and Compass
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
From PSD to WordPress Theme: Bringing designs to life
Rails3 asset-pipeline
125 고성능 web view-deview 2013 발표 자료_공유용
Membuat slide show pada posting
WordPress as the Backbone(.js)
Mobile themes, QR codes, and shortURLs
Drupal as a web framework

Recently uploaded (20)

PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
Cloud computing and distributed systems.
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Modernizing your data center with Dell and AMD
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Electronic commerce courselecture one. Pdf
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Encapsulation theory and applications.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Understanding_Digital_Forensics_Presentation.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Cloud computing and distributed systems.
Per capita expenditure prediction using model stacking based on satellite ima...
Network Security Unit 5.pdf for BCA BBA.
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Advanced methodologies resolving dimensionality complications for autism neur...
Chapter 3 Spatial Domain Image Processing.pdf
Modernizing your data center with Dell and AMD
“AI and Expert System Decision Support & Business Intelligence Systems”
Review of recent advances in non-invasive hemoglobin estimation
Electronic commerce courselecture one. Pdf
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Digital-Transformation-Roadmap-for-Companies.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Encapsulation theory and applications.pdf
NewMind AI Monthly Chronicles - July 2025
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf

Responsive Web Design tehnike u WordPress-u

  • 1. Responsive Web Design tehnike u WordPressu Igor Benić WP Meetup Zagreb 19.09
  • 2. Sadržaj • O meni • Što je RWD? • Izrada RWD-a • Slike u RWD-u • WordPress i RWD • Slike u WordPress-u • WordPress Mobile • Pitanja
  • 3. O meni • Front End Developer @ Multilink • Co-founder – www.lakotuts.com • PSD -> PHP • Autor knjige: WordPress na Bootstrap-u 3.x
  • 4. O meni • Bootstrap 3 • Izrada osnovne i naprednih tema • Customizer API • Settings API • AJAX http://leanpub.com/wpb3
  • 5. Što je RWD? • Stranica (sadržaj) se prilagođava ekranu – Točke izmjene • Vrste RWD-a – Responsive – Adaptive • Sadržaj • Brzina
  • 6. Izrada RWD-a • Mobile First • Desktop First • Korištenje Alata • CSS od nule • Korištenje Frameworka
  • 7. Načini izrade - Framework • Bootstrap 3 • Foundation • Skeleton • Gumby • Mnogi drugi
  • 8. Slike u RWD-u • Nisu jednostavne – Servirati samo potrebnu sliku – Paziti i na Retina ekrane • Moguća rješenja – Picturefill 2.0 – BttrLazyLoading
  • 9. Slike u RWD-u – PictureFill 2.0 <picture> <!--[if IE 9]><video style="display: none;"><![endif]--> <source srcset="examples/images/extralarge.jpg" media="(min- width: 1000px)"> <source srcset="examples/images/large.jpg" media="(min-width: 800px)"> <source srcset="examples/images/large@2.jpg" media="(min- width: 800px) and (-webkit-min-device-pixel-ratio: 2)"> <!--[if IE 9]></video><![endif]--> <img srcset="examples/images/medium.jpg" alt="A giant stone face at The Bayon temple in Angkor Thom, Cambodia"> </picture>
  • 10. Slike u RWD-u – BttrLazyLoading <img id="yourImageId" class="bttrlazyloading" data-bttrlazyloading-xs-src="img/768x200.gif" data-bttrlazyloading-xs-width="768" data-bttrlazyloading-xs-height="200" data-bttrlazyloading-sm-src="img/345x250.gif" data-bttrlazyloading-sm-width="345" data-bttrlazyloading-sm-height="250" data-bttrlazyloading-md-src="img/455x350.gif" data-bttrlazyloading-md-width="455" data-bttrlazyloading-md-height="350" d data-bttrlazyloading-lg-src="img/360x300.gif" data-bttrlazyloading-lg-width="360" data-bttrlazyloading-lg-height="300" />
  • 11. WordPress i RWD RESS Pružanje sadržaja ovisno o uređaju Prilagodba sadržaja na serveru
  • 12. Slike u WordPress-u • Različite verzije za istu sliku – add_image_size(“verzija”, širina, visina, [true | false]); • add_filter(“post_thumbnail”, funkcija_za_promjenu);
  • 13. Slike u WordPress-u - Thumbnailovifunction wpb3_thumbnail_html($html, $post_id, $aid, $sizeThumb, $attr){ if($sizeThumb == "slika-clanka"){ $sizes = array('slika-clanka‘, 'slika-clanka-md‘, 'slika-clanka-sm‘, 'slika-clanka-xs’); $img = "<img class='bttrLazyLoading img-responsive' alt='".get_the_title()."'"; $sizeBttr = ""; $width = ""; $height = ""; $aid = (!$aid) ? get_post_thumbnail_id() : $aid; foreach ( $sizes as $size ) { $url = wp_get_attachment_image_src( $aid, $size ); switch ($size) { case 'slika-clanka': $sizeBttr = "lg"; $width = "750"; $height= "353"; break; ... } $img .= " data-bttrlazyloading-".$sizeBttr."-src='". $url[0] ."' "; $img .= " data-bttrlazyloading-".$sizeBttr."-width='". $width ."' "; $img .= " data-bttrlazyloading-".$sizeBttr."-height='". $height ."' "; } $img .= " />"; return $img; } return $html; } add_filter( 'post_thumbnail_html', 'wpb3_thumbnail_html', 10, 5);
  • 14. Slike u WordPress-u - Content • Filtrirati slike prilikom ispisa ili obrisati (na mobitelima) – add_filter(‘the_content’, ‘funkcija za filtriranje slika’) • CSS: – .post img {max-width:100%;height:auto;} function slike_u_content() { global $post; $html = preg_replace_callback( '#(<imgs[^>]*src)="([^"]+)"#', "callback_img", get_the_content($post->ID) ); return $html; } function callback_img($match) { list(, $img, $src) = $match; $url = get_stylesheet_directory_uri().'/img_placeholder.gif'; return "$img="$url" data-href="$src" "; }
  • 15. Slike u WordPress-u - LakoTuts • Filtrirati slike prilikom ispisa – add_filter(‘the_content’, ‘funkcija za filtriranje slika’) • CSS: – .post img {max-width:100%;height:auto;} $attachment_id = lakotuts_get_attachment_id_from_url($header_image); $image480 = wp_get_attachment_image_src( $attachment_id, 'image480' ); $image768 = wp_get_attachment_image_src( $attachment_id, 'image768' ); $image1024 = wp_get_attachment_image_src( $attachment_id, 'image1024' ); $image1920 = wp_get_attachment_image_src( $attachment_id, 'image1920' ); echo ‘ #masthead { background-image: url(''. $image768[0] .''); } '; echo '@media (min-width:768px) { #masthead { background-image: url(''. $image768[0] .''); }}'; echo '@media (min-width:1024px) { #masthead { background-image: url(''. $image1024[0] .''); }}'; echo '@media (min-width:1200px) { #masthead { background-image: url(''. $image1920[0] .''); }}';
  • 16. WordPress Mobile • wp_mobile() • WURFL baza podataka • github.com/jcasabona/wp-ress/
  • 17. WordPress Mobile function wpr_detect_mobile_device(){ try{ $config = new WurflCloud_Client_Config(); $config->api_key = WPR_API_KEY; $client = new WurflCloud_Client_Client($config); $client->detectDevice(); return $client->getDeviceCapability('is_wireless_device'); } catch (Exception $e){ return wp_is_mobile(); } } define('WPR_IS_MOBILE', wpr_detect_mobile_device());
  • 18. WordPress Mobile • Izbornici za Desktop i Mobitele/Tablete – Izbjegnut dvostruki HTML sadržaj • Prikaz pojedinog sadržaja samo na zahtjev – Komentari – Sidebar