<?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>A Fool's Wisdom &#187; URLs</title>
	<atom:link href="http://foolswisdom.com/tag/urls/feed/" rel="self" type="application/rss+xml" />
	<link>http://foolswisdom.com</link>
	<description>A fool and his blog are soon parted.</description>
	<lastBuildDate>Mon, 12 Dec 2011 22:39:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Gmail&#8217;s Sweetest Feature, the URL</title>
		<link>http://foolswisdom.com/gmails-url/</link>
		<comments>http://foolswisdom.com/gmails-url/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 21:13:43 +0000</pubDate>
		<dc:creator>Lloyd</dc:creator>
				<category><![CDATA[Opinion]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Email Clients]]></category>
		<category><![CDATA[Email Readers]]></category>
		<category><![CDATA[Google Gmail]]></category>
		<category><![CDATA[Mail User Agents]]></category>
		<category><![CDATA[MUA]]></category>
		<category><![CDATA[Software Features]]></category>
		<category><![CDATA[URIs]]></category>
		<category><![CDATA[URLs]]></category>
		<category><![CDATA[Web Applications]]></category>
		<category><![CDATA[Web Apps]]></category>

		<guid isPermaLink="false">http://foolswisdom.com/?p=2457</guid>
		<description><![CDATA[Gmail&#8217;s sweetest feature is that each view has a unique URL. This provides simple integration with other applications. In other words, I copy and paste an email&#8217;s URL into my to do list, and at any time, with a single &#8230; <a href="http://foolswisdom.com/gmails-url/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Gmail&#8217;s sweetest feature is that each view has a unique URL.</p>
<p>This provides simple integration with other applications. In other words, I copy and paste an email&#8217;s URL into my to do list, and at any time, with a single click I can get right back to the email.</p>
<p>Try doing that with any other email client!</p>
]]></content:encoded>
			<wfw:commentRss>http://foolswisdom.com/gmails-url/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>wp-content in Code is a Tell for Common WordPress Coding Mistakes</title>
		<link>http://foolswisdom.com/wp-content-in-code-common-mistakes/</link>
		<comments>http://foolswisdom.com/wp-content-in-code-common-mistakes/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 18:59:39 +0000</pubDate>
		<dc:creator>Lloyd</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Absolution Paths]]></category>
		<category><![CDATA[ABSPATH]]></category>
		<category><![CDATA[bloginfo()]]></category>
		<category><![CDATA[Duane Storey]]></category>
		<category><![CDATA[get_stylesheet_directory()]]></category>
		<category><![CDATA[get_stylesheet_directory_uri()]]></category>
		<category><![CDATA[get_stylesheet_uri()]]></category>
		<category><![CDATA[Mark Jaquith]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Plugin Development]]></category>
		<category><![CDATA[Relative Paths]]></category>
		<category><![CDATA[STYLESHEETPATH]]></category>
		<category><![CDATA[TEMPLATEPATH]]></category>
		<category><![CDATA[URLs]]></category>
		<category><![CDATA[Will Norris]]></category>
		<category><![CDATA[WordPress Plugin Checker]]></category>
		<category><![CDATA[WordPress Theme Development]]></category>
		<category><![CDATA[WordPress.com]]></category>
		<category><![CDATA[wp-content]]></category>
		<category><![CDATA[WP_CONTENT_DIR]]></category>

		<guid isPermaLink="false">http://foolswisdom.com/?p=1813</guid>
		<description><![CDATA[Regularly while reviewing themes and plugins, I&#8217;ll see URLs or paths that include &#8216;wp-content&#8217;. This is a often a hint of a WordPress coding mistake. Consider this simple example: &#60;link rel="stylesheet" href="http://example.com/wp-content/themes/default/style-ie.css" type="text/css" media="screen" /&#62; If as part of a &#8230; <a href="http://foolswisdom.com/wp-content-in-code-common-mistakes/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Regularly while reviewing themes and plugins, I&#8217;ll see URLs or paths that include &#8216;wp-content&#8217;. This is a often a hint of a WordPress coding mistake.</p>
<p>Consider this simple example:<br />
<code>&lt;link rel="stylesheet" href="http://example.com/wp-content/themes/default/style-ie.css" type="text/css" media="screen" /&gt;</code></p>
<p>If as part of a migration or server change, WordPress ends up in a sub-directory this will break.</p>
<p>For file system based access, if I see <code>ABSPATH . '/wp-content/</code> &#8230; things are likely OK, though if <code><a href="http://codex.wordpress.org/Editing_wp-config.php#Moving_wp-content">WP_CONTENT_DIR</a></code> or similar are changed, this will also break.</p>
<p>I&#8217;m tempted to use the constant <code>STYLESHEETPATH</code> or is it <code>TEMPLATEPATH</code>? But, those are static variables initialized early in the WordPress run.</p>
<p>I&#8217;ve been meaning to write this article for a while. Serendipitously, when I went to write a first draft of it, <a href="http://markjaquith.com/">Mark Jaquith</a>&#8216;s had just published &#8220;<a href="http://markjaquith.wordpress.com/2009/05/04/force-css-changes-to-go-live-immediately/">Force CSS changes to “go live” immediately</a>&#8220;.</p>
<p>In the comments, <a href="http://op111.net/">demetris</a> <a href="http://markjaquith.wordpress.com/2009/05/04/force-css-changes-to-go-live-immediately/#comment-92283">suggests</a> using STYLESHEETPATH, but <a href="http://willnorris.com/">Will Norris</a> quickly <a href="http://markjaquith.wordpress.com/2009/05/04/force-css-changes-to-go-live-immediately/#comment-92284">points out</a> &#8220;sure, but you still have the same problem of bypassing any plugins that may be using the ’stylesheet_directory’ hook to pull the stylesheet from some place else entirely.&#8221;</p>
<p>Mark&#8217;s solution beautiful illustrates how to get the the URL location of the theme&#8217;s files and also directly the URL for the main stylesheet style.css:</p>
<p><code>&lt;link rel="stylesheet" href="&lt;?php <strong>bloginfo('stylesheet_url')</strong>; echo '?' . filemtime( <strong>get_stylesheet_directory()</strong> . '/style.css'); ?&gt;" type="text/css" media="screen, projection" /&gt;</code></p>
<p>What Will describes is exactly what WordPress.com depends on. We have a similar, but much more complex solution to deal with the CSS in the content delivery network (CDN) going stale on updates, and also some web browser&#8217;s with their funky caches not keeping up. Our solution is both for WordPress&#8217;s front end and dashboard (also dealing with the various ways CSS can be called or @imported).</p>
<p>I do have one niggle about Mark&#8217;s solution, and it&#8217;s the same with most WordPress code out there, the use of <code>bloginfo()</code>. Strings within strings within strings within strings give me headache, so to ease readability and make it more verbose replace:</p>
<p><code>bloginfo('stylesheet_url');</code> with<code><br />
echo get_stylesheet_uri();</code></p>
<p><code>bloginfo('stylesheet_directory');</code> with<br />
<code>echo get_stylesheet_directory_uri();</code></p>
<p>If you look up in the <a href="http://codex.wordpress.org/">codex</a> <code>get_stylesheet_directory()</code> you&#8217;ll see that would be the file system path, which is confusing given the behavior of <code>bloginfo('stylesheet_directory');</code> returning the URL. This presents another reason why I favor the consistency of always using the specific getter function calls. Also, when I&#8217;m using <code>bloginfo()</code> calls, I have a tendency to get in a mind set where I think I&#8217;m directly retrieving the option in the database (accessing directly the info shown in <code>wp-admin/options.php</code>). By using the specific getter function, I remember that there are hooks (actions, filters) that might be triggered.</p>
<p>Some of the other areas, I see <code>wp-content</code> is in CSS style sheets themselves. <strong>Relative paths</strong> are almost always the correct solution.</p>
<p>Far more painful for me are the plugins that assume where plugins are, because this can take quite a bit of debugging to unwind the assumptions.</p>
<p>That is a topic for me to postulate on another day. Will has written the very relevant &#8220;<a href="http://willnorris.com/2009/06/wordpress-plugin-pet-peeve-2-direct-calls-to-plugin-files">WordPress Plugin Pet Peeve #2: Direct Calls to Plugin Files</a>&#8220;. <a href="http://www.duanestorey.com/">Duane Storey</a> has taken a crack at a &#8220;<a href="http://www.duanestorey.com/blog/2009/wordpress-plugin-checker/">WordPress Plugin Checker</a>&#8220;  for these and other common problems (which I&#8217;m certain he would enjoy feedback on).</p>
]]></content:encoded>
			<wfw:commentRss>http://foolswisdom.com/wp-content-in-code-common-mistakes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

