<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>Big Red Tin &#187; rants</title> <atom:link href="http://bigredtin.com/tag/rants/feed/" rel="self" type="application/rss+xml" /><link>http://bigredtin.com</link> <description>Thoughts about the web and business from the large pantry</description> <lastBuildDate>Wed, 08 Sep 2010 20:42:44 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>Charging for themes? Do the right thing!</title><link>http://bigredtin.com/behind-the-websites/charging-for-themes-do-the-right-thing/</link> <comments>http://bigredtin.com/behind-the-websites/charging-for-themes-do-the-right-thing/#comments</comments> <pubDate>Thu, 12 Nov 2009 00:23:42 +0000</pubDate> <dc:creator>Peter Wilson</dc:creator> <category><![CDATA[Behind the Websites]]></category> <category><![CDATA[CSS]]></category> <category><![CDATA[JavaScript]]></category> <category><![CDATA[rants]]></category> <category><![CDATA[themes]]></category> <category><![CDATA[WordPress]]></category><guid
isPermaLink="false">http://soupgiant.com/?p=240</guid> <description><![CDATA[Of all the Wordpress functions, I think wp_register_script, wp_register_style, wp_enqueue_script, and, wp_enqueue_style are the most elegant.]]></description> <content:encoded><![CDATA[<p>Of all the WordPress functions, I think <code>wp_register_script</code>, <code>wp_register_style</code>, <code>wp_enqueue_script</code>, and, <code>wp_enqueue_style</code> are the most elegant. It&#8217;s possible to get away with using only the <code>wp_enqueue_*</code> functions, but I prefer to use both for a little bit more control.</p><p>For the uninitiated, these functions allow you to add JavaScript and CSS files to the header (or footer, in later versions of <abbr
title="WordPress">WP</abbr>) without running of the risk of another plugin adding the same file, that is, you avoid the following:</p><pre><code>&lt;script type="text/javascript" source="http://.../a-plugin/jQuery.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" source="http://.../a-plugin/plugin.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" source="http://.../my-theme/jQuery.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" source="http://.../my-theme/theme.js"&gt;&lt;/script&gt;</code></pre><p>If you develop themes or plugins for WordPress and are unaware of these functions, you should refer to the codex to get the low down on at least <code><a
href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script">wp_enqueue_script</a></code>, and <code><a
href="http://codex.wordpress.org/Function_Reference/wp_enqueue_style">wp_enqueue_style</a></code> &#8211; these register and queue the files, the <code>wp_register_*</code> functions register the file ready to be queued for output.</p><h4>The Rant</h4><p>Despite the value these functions can add to themes and plugins, they are under-utilised in development. The functions have wider adoption in plug-in development, but it&#8217;s still well below 100%. In theme development adoption is virtually non-existent (at least in the themes I&#8217;ve used).</p><p>This failure to code properly is evenly spread across both free and paid themes. I?m happy to look the other way for free themes. After all, the motivation behind the theme may have been to learn WordPress development.</p><p>In commercial themes, particularly those above the US$30-$35 price point, it&#8217;s downright frustrating that these products haven&#8217;t been developed properly.</p><p>When someone purchases a theme, they shouldn&#8217;t have to debug the product to find out why a JavaScript framework is being included twice. The reason for the purchase is that they either don&#8217;t want to, or know how to, develop.</p><h4>Avoiding costly mistakes</h4><p>Evaluating a commercial theme on behalf of a client triggered this rant. At $195, it&#8217;s quite expensive in the world of WordPress. As I was viewing the source code of the online demo, I discovered the <em>faux pas</em>. We&#8217;ll advise against using that theme as a starting point. In fact, within short time we&#8217;d found a theme $195 cheaper that would do the job.</p><p>Looking at the source code of a demo site is usually enough to tell you how the theme is inserting its scripts:</p><ul><li>Both &lt;link&gt; and &lt;script&gt; tags will use single quotes around attributes (&#8216;), rather than double quotes (&#8220;),</li><li>CSS &lt;link&gt; tags will have an ID attribute ending in -css, eg: id=&#8217;shadowbox-css-css&#8217;, and,</li><li>JavaScript and CSS files include the version number as a query string eg jQuery.js?ver=1.3.2 (although a hook can be used to remove this)</li></ul><p>Making sure that the <code>wp_register_script</code>, <code>wp_register_style</code>, <code>wp_enqueue_script</code>, and, <code>wp_enqueue_style</code> are included properly will save time, bandwidth and also avoid some detrimental conflicts.</p> ]]></content:encoded> <wfw:commentRss>http://bigredtin.com/behind-the-websites/charging-for-themes-do-the-right-thing/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced)
Database Caching 18/25 queries in 0.004 seconds using apc
Content Delivery Network via sg.assets.sgiant.com/pressgiant

Served from: bigredtin.com @ 2010-09-10 22:37:26 -->