<html><body bgcolor="#FFFFFF"><div>So...a better approach would be what? Rewrite all plugins that don't follow best practices?</div><div><br></div><div>That still wouldn't address issues like client-side load order (e.g. to optimize page load times).</div><div><br></div><div>A real example where wp_head filtering is useful is in conjunction with the Contact Form 7 plugin. By default, enabling that plugin would insert a CSS file and script into the head of every page. With a custom filter and a conditional statement, I can make sure only the contact form page loads those resources.</div><div><br></div><div>In many cases, this can also be achieved "more elegantly" by removing hooked functions, but filtering the output buffer (i.e., working with regex) is much faster/easier than digging through plugins, searching for the custom function code that hooked into wp_head.</div><div><br>-Darren Slatten</div><div><br>On Jun 29, 2011, at 1:44 PM, Chip Bennett &lt;<a href="mailto:chip@chipbennett.net">chip@chipbennett.net</a>&gt; wrote:<br><br></div><div></div><blockquote type="cite"><div>I think you have that approach exactly backwards. Plugins should be looking after themselves, by hooking properly into appropriate hooks. Theme and Plugins should mostly stay out of one another's way.<div><br></div><div>
If Theme and Plugins all enqueue jQuery properly, then there will *never* be duplicate jQuery scripts enqueued.</div><div><br></div><div>Chip</div><div><br><div class="gmail_quote">On Wed, Jun 29, 2011 at 11:45 AM, Gmail <span dir="ltr">&lt;<a href="mailto:darrenslatten@gmail.com"><a href="mailto:darrenslatten@gmail.com">darrenslatten@gmail.com</a></a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I use output buffering on wp_head() and wp_footer(), in order to give my theme complete control over them. Since most plugins hook onto these, they can become cluttered with scripts and CSS file links. By using OB and a custom filter, I can do things like (1) remove duplicate jQuery scripts, and (2) optimize the order that CSS and scripts are loaded in. Essentially this gives my theme the final say in what resources are loaded into the page, allowing me to "clean up after" plugins.<br>

<br>
-Darren Slatten<br>
<div><div></div><div class="h5"><br>
On Jun 29, 2011, at 10:12 AM, Vicky Arulsingam &lt;<a href="mailto:vicky.arulsingam@gmail.com"><a href="mailto:vicky.arulsingam@gmail.com">vicky.arulsingam@gmail.com</a></a>&gt; wrote:<br>
<br>
&gt; I've asked the theme author to explain the usage. If there's a valid<br>
&gt; use for it then it should be allowed but I haven't a clue how.<br>
&gt;<br>
&gt; On 6/29/11, Ryan Hellyer &lt;<a href="mailto:ryan@pixopoint.com"><a href="mailto:ryan@pixopoint.com">ryan@pixopoint.com</a></a>&gt; wrote:<br>
&gt;&gt; There are many reasons to use output buffering (ob_start etc), but<br>
&gt;&gt; they would rarely be used within a theme. I've seen themes which use<br>
&gt;&gt; buffering as a way to dynamically minify the markup, but that's a<br>
&gt;&gt; horrid way to do it - much better incorporated within a caching plugin<br>
&gt;&gt; IMO.<br>
&gt;&gt;<br>
&gt;&gt; There may be a practical use for output buffer in a theme, but I'm<br>
&gt;&gt; darned if I can think of a good example. I wouldn't want to see it<br>
&gt;&gt; banned outright, as someone may come up with a cunning use for it that<br>
&gt;&gt; none of us have thought of.<br>
&gt;&gt;<br>
&gt;&gt; Perhaps the theme check plugin could check for output buffering<br>
&gt;&gt; functions and leave a request for the theme developer to provide a<br>
&gt;&gt; reason for using it? That way they'll know it's non-standard and<br>
&gt;&gt; provide a reason (good or bad) for the theme reviewers to read. Could<br>
&gt;&gt; potentially save a little to and fro'ing in the future. Just an idea.<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; theme-reviewers mailing list<br>
&gt;&gt; <a href="mailto:theme-reviewers@lists.wordpress.org"><a href="mailto:theme-reviewers@lists.wordpress.org">theme-reviewers@lists.wordpress.org</a></a><br>
&gt;&gt; <a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank"><a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a></a><br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; -----<br>
&gt; Vicky Arulsingam<br>
&gt; _______________________________________________<br>
&gt; theme-reviewers mailing list<br>
&gt; <a href="mailto:theme-reviewers@lists.wordpress.org"><a href="mailto:theme-reviewers@lists.wordpress.org">theme-reviewers@lists.wordpress.org</a></a><br>
&gt; <a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank"><a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a></a><br>
_______________________________________________<br>
theme-reviewers mailing list<br>
<a href="mailto:theme-reviewers@lists.wordpress.org"><a href="mailto:theme-reviewers@lists.wordpress.org">theme-reviewers@lists.wordpress.org</a></a><br>
<a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank"><a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a></a><br>
</div></div></blockquote></div><br></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>theme-reviewers mailing list</span><br><span><a href="mailto:theme-reviewers@lists.wordpress.org">theme-reviewers@lists.wordpress.org</a></span><br><span><a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a></span><br></div></blockquote></body></html>