From ecfaefd7517ba4fb291cb37951b075caa655b7c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis-R=C3=A9mi=20Bab=C3=A9?= Date: Tue, 14 May 2013 19:02:09 +0300 Subject: [PATCH 1/2] Never remove media attribute on link tags --- lib/cleanup.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/lib/cleanup.php b/lib/cleanup.php index a9f1833..6108b5a 100644 --- a/lib/cleanup.php +++ b/lib/cleanup.php @@ -94,17 +94,6 @@ function roots_wp_title($title) { } add_filter('wp_title', 'roots_wp_title', 10); -/** - * Clean up output of stylesheet tags - */ -function roots_clean_style_tag($input) { - preg_match_all("!!", $input, $matches); - // Only display media if it's print - $media = $matches[3][0] === 'print' ? ' media="print"' : ''; - return '' . "\n"; -} -add_filter('style_loader_tag', 'roots_clean_style_tag'); - /** * Add and remove body_class() classes */ From de206a2cf74d944fff45d9659967d2ad69c0b519 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis-R=C3=A9mi=20Bab=C3=A9?= Date: Tue, 14 May 2013 20:06:33 +0300 Subject: [PATCH 2/2] Only display media if it is meaningful --- lib/cleanup.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/cleanup.php b/lib/cleanup.php index 6108b5a..4555077 100644 --- a/lib/cleanup.php +++ b/lib/cleanup.php @@ -94,6 +94,17 @@ function roots_wp_title($title) { } add_filter('wp_title', 'roots_wp_title', 10); +/** + * Clean up output of stylesheet tags + */ +function roots_clean_style_tag($input) { + preg_match_all("!!", $input, $matches); + // Only display media if it is meaningful + $media = $matches[3][0] !== '' && $matches[3][0] !== 'all' ? ' media="' . $matches[3][0] . '"' : ''; + return '' . "\n"; +} +add_filter('style_loader_tag', 'roots_clean_style_tag'); + /** * Add and remove body_class() classes */