[theme-reviewers] Theme cleanup

Ola Łączek ola at bodera.com
Mon Feb 24 16:06:18 UTC 2014


Hello!

Thank you for your answers. Here's what's being done to <link> tag:

/**
 * Clean up output of stylesheet <link> tags
 */
function sme_clean_style($input) {
    preg_match_all("!<link rel='stylesheet'\s?(id='[^']+')?\s+href='(.*)'
type='text/css' media='(.*)' />!", $input, $matches);
    // Only display media if it is meaningful
    $media = $matches[3][0] !== '' && $matches[3][0] !== 'all' ? ' media="'
. $matches[3][0] . '"' : '';
    // Add a 4 spaces indent before <link...
    return '    <link rel="stylesheet" href="' . $matches[2][0] . '"' .
$media . '>' . "\n";
}
add_filter('style_loader_tag', 'sme_clean_style');


Best regards,
Ola Laczek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20140224/a8b9605c/attachment.html>


More information about the theme-reviewers mailing list