[theme-reviewers] Theme cleanup

Chip Bennett chip at chipbennett.net
Mon Feb 24 16:10:31 UTC 2014


I would say 1) that's not presentational,  2) it can actively interfere
with parameters passed to wp_enqueue_style(), even for stylesheets not
enqueued by the Theme, and 3) if the Theme needs to modify one of those
parameters (such as $media) for its own stylesheets, it can do so via
wp_enqueue_style().


On Mon, Feb 24, 2014 at 11:06 AM, Ola Łączek <ola at bodera.com> wrote:

> 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
>
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20140224/e55dbda1/attachment-0001.html>


More information about the theme-reviewers mailing list