<?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>Scratch99 Design</title>
	<atom:link href="http://scratch99.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://scratch99.com</link>
	<description>WordPress products and services</description>
	<lastBuildDate>Sun, 06 Oct 2019 12:37:48 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.7.15</generator>
	<item>
		<title>Restart Apache Via Command Prompt In XAMPP Windows With No UAC Prompt</title>
		<link>http://scratch99.com/web-development/php/restart-apache-via-command-prompt-xampp-windows-no-uac-prompt/</link>
		
		<dc:creator><![CDATA[Stephen Cronin]]></dc:creator>
		<pubDate>Fri, 23 Jun 2017 03:23:11 +0000</pubDate>
				<category><![CDATA[PHP Development]]></category>
		<guid isPermaLink="false">http://scratch99.com/?p=923</guid>

					<description><![CDATA[This post is the result of about 3 or 4 hours of Googling! There are so many false trails out there that I almost gave up, but I managed to work out how to do this most impossible of things: Restart Apache from the command prompt (Git Bash, CMD.EXE, batch file) on Windows 10, without&#8230;<p><a class="more-link" href="http://scratch99.com/web-development/php/restart-apache-via-command-prompt-xampp-windows-no-uac-prompt/" title="Continue reading &#8216;Restart Apache Via Command Prompt In XAMPP Windows With No UAC Prompt&#8217;">Continue reading <span class="meta-nav">&#8594;</span></a></p>]]></description>
										<content:encoded><![CDATA[<p>This post is the result of about 3 or 4 hours of Googling! There are so many false trails out there that I almost gave up, but I managed to work out how to do this most impossible of things:</p>
<p>Restart Apache from the command prompt (Git Bash, CMD.EXE, batch file) on Windows 10, <strong>without</strong> receiving the &quot;Do you want to allow this app to make changes to your device&quot; prompt:</p>
<p><span id="more-923"></span></p>
<p><img loading="lazy" src="http://scratch99.com/wp-content/uploads/2017/06/uac.png" alt="The UAC prompt" width="456" height="316" class="alignnone size-full wp-image-924" /></p>
<p>Or without the Access Denied message:</p>
<p><img loading="lazy" src="http://scratch99.com/wp-content/uploads/2017/06/uac2.png" alt="Access Denied message when running the net command" width="387" height="198" class="alignnone size-full wp-image-925" /></p>
<p>I won&#8217;t list all the things that don&#8217;t work. There are too many! Here&#8217;s how to do it:</p>
<p>First, you need to install Apache as Windows Service (note you must run the Xampp control panel as Administrator to be able to select this):</p>
<p><img loading="lazy" src="http://scratch99.com/wp-content/uploads/2017/06/uac3.png" alt="Installing Apache as a service on Xampp" width="663" height="244" class="alignnone size-full wp-image-926" srcset="http://scratch99.com/wp-content/uploads/2017/06/uac3.png 663w, http://scratch99.com/wp-content/uploads/2017/06/uac3-500x184.png 500w" sizes="(max-width: 663px) 100vw, 663px" /></p>
<p>You then need to find out the service name for Apache. It&#8217;s probably Apache2.4 but click on Services, find it in the list and double check it.</p>
<p>Next you need to create a Windows batch file called <code>restart-apache.bat</code>, with the following contents (replacing Apache2.4 with the name of the service we just started):</p>
<p class="codebox">
<code>net stop Apache2.4<br />
net start Apache2.4</code>
</p>
<p>Don&#8217;t bother trying to run this batch file, it won&#8217;t work. Both commands will fail with the Access Denied message.</p>
<p>There are plenty of &#8216;solutions&#8217; out there to make this work, including creating a shortcut to the batch file and setting run as Administrator in the properties. That sort of works, but you still get the &quot;Do you want to allow this app to make changes to your device&quot; prompt (minimized, requiring a mouse click to open). </p>
<p>So forget all of those solutions. Except for this one, that tells you how to <a href="https://www.sevenforums.com/tutorials/11949-elevated-program-shortcut-without-uac-prompt-create.html">avoid the UAC prompt using the Task Scheduler</a>. </p>
<p>We won&#8217;t follow that exactly, but go through steps 1 to 6, setting up a task called Restart Apache, setting it to run with the highest privileges and configuring it for Windows 10. </p>
<p><img loading="lazy" src="http://scratch99.com/wp-content/uploads/2017/06/uac4.png" alt="Setting up a scheduled task for restarting Apache" width="624" height="471" class="alignnone size-full wp-image-927" srcset="http://scratch99.com/wp-content/uploads/2017/06/uac4.png 624w, http://scratch99.com/wp-content/uploads/2017/06/uac4-500x377.png 500w" sizes="(max-width: 624px) 100vw, 624px" /></p>
<p>Instead of entering <code>%windir%\System32\cmd.exe</code> as the action in step 7, just enter the path to the <code>restart-apache.bat</code> file we created above. There&#8217;s no need for any optional arguments in step 8.</p>
<p><img loading="lazy" src="http://scratch99.com/wp-content/uploads/2017/06/uac5.png" alt="Entering the command to run to restart Apache in Task Scheduler" width="627" height="473" class="alignnone size-full wp-image-928" srcset="http://scratch99.com/wp-content/uploads/2017/06/uac5.png 627w, http://scratch99.com/wp-content/uploads/2017/06/uac5-500x377.png 500w" sizes="(max-width: 627px) 100vw, 627px" /></p>
<p>Note: You <em>can</em> set it up to run the batch file using cmd.exe and start as per the article, <em>but</em> it doesn&#8217;t close after restarting Apache &#8211; running the batch file directly will close itself when done.</p>
<p>Keep going through the remaining steps to make sure it works when you&#8217;re laptop&#8217;s not plugged in and to create the shortcut to the scheduled task we just created. It&#8217;s probably sensible to save the shortcut in the same folder as the batch file so everything is kept together.</p>
<p>You obviously need to change the name of the service to the one we created above (<code>"Restart Apache"</code> unless you named it something different).</p>
<p><img loading="lazy" src="http://scratch99.com/wp-content/uploads/2017/06/uac6.png" alt="Entering the task schedular command in the shortcut" width="578" height="336" class="alignnone size-full wp-image-929" srcset="http://scratch99.com/wp-content/uploads/2017/06/uac6.png 578w, http://scratch99.com/wp-content/uploads/2017/06/uac6-500x291.png 500w" sizes="(max-width: 578px) 100vw, 578px" /></p>
<p>Click next and name the short cut <code>restart-apache</code>. You won&#8217;t be able to see it, but it&#8217;s extension is <code>.lnk</code> so we can access this shortcut via <code>restart-apache.lnk</code>.</p>
<p>You can test it out right now by double clicking on the shortcut:</p>
<p><img loading="lazy" src="http://scratch99.com/wp-content/uploads/2017/06/uac8.gif" alt="GIF image showing the Apache service stopping and starting without any prompts" width="841" height="489" class="alignnone size-full wp-image-930" /></p>
<p>There&#8217;s probably no need for steps 16 to 22. We don&#8217;t really need it to have an icon as we&#8217;ll be calling it via the command line anyway, rather than clicking on it. </p>
<p>Speaking of which, you run it from the command line using the following command (adding the path to the file name if you&#8217;re not in the same folder):</p>
<p class="codebox"><code>start "" "restart-apache.lnk"</code></p>
<p>That should work in CMD.EXE, a batch file, Git Bash, etc. I <em>think</em> the Windows Subsystem for Linux supports Start, but it seems like there are some hoops to jump through.</p>
<p>Anyway, that&#8217;s it! Go start using it in all your scripts! </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How To Force An Update To A Borked Plugin</title>
		<link>http://scratch99.com/wordpress/development/force-update-borked-plugin/</link>
		
		<dc:creator><![CDATA[Stephen Cronin]]></dc:creator>
		<pubDate>Thu, 22 Jun 2017 11:13:28 +0000</pubDate>
				<category><![CDATA[WordPress Development]]></category>
		<guid isPermaLink="false">http://scratch99.com/?p=921</guid>

					<description><![CDATA[Editorial Note I originally wrote this post a couple of years ago when my, um&#8230; friend, was a little less clever than he is now. In hindsight, I wasn&#8217;t sure the technique included here was a good idea, so I never published it. I&#8217;m publishing it now just in case it helps anyone and because&#8230;<p><a class="more-link" href="http://scratch99.com/wordpress/development/force-update-borked-plugin/" title="Continue reading &#8216;How To Force An Update To A Borked Plugin&#8217;">Continue reading <span class="meta-nav">&#8594;</span></a></p>]]></description>
										<content:encoded><![CDATA[<div id="editorial-note">
<strong>Editorial Note</strong><br />
I originally wrote this post a couple of years ago when my, um&#8230; friend, was a little less clever than he is now. In hindsight, I wasn&#8217;t sure the technique included here was a good idea, so I never published it. I&#8217;m publishing it now just in case it helps anyone and because it was fun to solve. It&#8217;s definitely use at your own risk.</div>
<p>So&#8230; Let&#8217;s just say for a moment, that you borked your plugin by accidentally tagging the whole repo. Never going to happen, right, because we all use deployment scripts, don&#8217;t we? </p>
<p><span id="more-921"></span></p>
<p>But let&#8217;s just suspend our belief for a moment. You&#8217;ve borked your plugin and instead of downloading it and testing it once it&#8217;s live, you go to bed. And while you&#8217;re having those sweet sweet dreams after a job seemingly well done, users have started updating. Only once they update, there is no your-plugin.php file any more, so the plugin promptly disables itself. You awake to urgent messages. </p>
<p>Hmm. You fix it and upload a working version, so they can just update it again. Nope. The plugin won&#8217;t appear in the plugins list any more. </p>
<p>Okay, they can just install it again from the Add Plugins screen. Nope. They&#8217;ll get an error telling them the plugin is already installed because the folder is already there, even though it doesn&#8217;t have a valid plugin inside it.</p>
<p>Defeat&#8230; Time for them to break out the old FTP client and upload the fixed version manually. Only this isn&#8217;t one user. This is everyone using your plugin. At least those who updated while it was broken. And some of these users aren&#8217;t exactly comfortable with FTP. </p>
<p>Of course. This is never going to happen, is it? But just say it did, perhaps it would be good to come up with a solution that would allow users to update the plugin via the backend.</p>
<h2>Saving The Day</h2>
<p>First, it must be said this is horribly hacky. And not without risk. <strong>Backups please!</strong> Perhaps it&#8217;s better not to even try this, or to only use it as a very last resort. But here&#8217;s what you may possibly decide to do &#8211; create instructions telling users to add the following to functions.php:</p>
<p>[sourcecode language=&#8221;php&#8221;]<br />
function fix_your_plugin_add_steps() {<br />
	echo &#8216;&lt;div class=&quot;updated&quot;&gt;&lt;p&gt;&lt;strong&gt;Fix the Your Plugin plugin:&lt;/strong&gt;&lt;ul&gt;&#8217;;<br />
	echo &#8216;&lt;li&gt;Step 1: &lt;a href=&quot;&#8217; . wp_nonce_url(self_admin_url( &#8216;update.php?action=upgrade-plugin&amp;plugin=your-plugin/your-plugin.php&#8217; ), &#8216;upgrade-plugin_your-plugin/your-plugin.php&#8217; ) . &#8216;&quot;&gt;Force Update&lt;/a&gt;&lt;/li&gt;&#8217;;<br />
	echo &#8216;&lt;li&gt;Step 2: Choose the Activate Plugin link from the resulting page&lt;/li&gt;&#8217;;<br />
	echo &#8216;&lt;li&gt;Step 3: &lt;a href=&quot;&#8217; . self_admin_url( &#8216;theme-editor.php?file=functions.php&amp;scrollto=100000&#8217; ) . &#8216;&quot;&gt;Return to functions.php&lt;/a&gt; and delete the code you added to create this list&lt;/li&gt;&#8217;;<br />
	echo &#8216;&lt;/ul&gt;&lt;/p&gt;&lt;/div&gt;&#8217;;<br />
}<br />
add_action( &#8216;admin_footer&#8217;, &#8216;fix_your_plugin_add_steps&#8217; );</p>
<p>function fix_your_plugin_force_update( $transient ) {<br />
	$obj = new stdClass();<br />
	$obj -&gt; slug = &#8216;your-plugin&#8217;;<br />
	$obj -&gt; new_version = &#8216;1.0.3&#8217;;<br />
	$obj -&gt; url = &#8216;https://wordpress.org/plugins/your-plugin/&#8217;;<br />
	$obj -&gt; package = &#8216;https://downloads.wordpress.org/plugin/your-plugin.1.0.3.zip&#8217;;<br />
	$transient -&gt; response[ &#8216;your-plugin/your-plugin.php&#8217; ] = $obj;<br />
	return $transient;<br />
}<br />
add_filter ( &#8216;pre_set_site_transient_update_plugins&#8217;, &#8216;fix_your_plugin_force_update&#8217; );<br />
[/sourcecode]</p>
<p>It (almost) goes without saying that you should replace all instances of <code>your-plugin</code>, <code>your_plugin</code> and <code>Your Plugin</code>, with the equivalent for your plugin, as well as replacing the two instances of <code>1.0.3</code> with the new version you want to upgrade to.
</p>
<h2>The Instructions</h2>
<p>As mentioned above, this is horribly, horribly hacky. You&#8217;d probably want to provide users with some decent instructions to follow, so as to limit the chance that this will just make their day (and yours) worse. Maybe something like this:</p>
<blockquote>
<p>The safest way to fix this is to manually FTP into your server and delete the your-plugin folder and then re-install the plugin.</p>
<p>If you are not comfortable with doing this, I have another option for you. However, it requires editing functions.php and if you make a mistake you may break your site, so please be very careful. In fact, I recommend doing a site backup before trying this.</p>
<p>To use this work around, please go to Appearance, then Editor and locate Theme Functions (functions.php) in the long list of files on the right. Click on it and that file will open.</p>
<p>Double check that it says Theme Functions (functions.php) above the code editor area. If so, click in the code editor and scroll right to the very bottom (you probably won&#8217;t be able to see it at first until you scroll all the way down). Make sure the cursor is flashing and none of the existing code is highlighted. </p>
<p>Open the attached file containing the code to fix this and copy the code. Return to the code editor and paste the code, checking that it is exactly the same.</p>
<p>Then click Update Plugin. The page will refresh and a list will appear at the top of the page with 3 steps for you to follow:</p>
<ol>
<li>Click the link in the first point to force the plugin to update itself to the latest version.</li>
<li>That will take you to a new page. Once the plugin has finished updating, you will be give a link to Activate Plugin. Click it.</li>
<li>That will take you back to the plugin screen. Click the link in the third point, which will take you back to editing functions.php, and remove the code we added above (taking care not to remove any other code).</li>
</ol>
<p>If all has gone well, you should fixed the plugin, activated it and removed the temporary list of steps. </p>
</blockquote>
<p>And of course you need to send them the code to go with this.</p>
<h2>Interesting Bits</h2>
<p>Whether this is a sensible thing to do or not, the code has some interesting stuff in there. </p>
<p>We are essentially mimicking what some premium plugins do &#8211; intercepting the call to the wordpress.org repository and adding our non-wordpress.org plugin to the list of plugins that WordPress has update information for. At this point, our plugin may as well be a non wordpress.org plugin, as the standard update mechanism is never going to allow our plugin to be updated. </p>
<p>We&#8217;re using <a href="http://code.tutsplus.com/tutorials/a-guide-to-the-wordpress-http-api-automatic-plugin-updates--wp-25181">the technique here</a>, only instead of telling WordPress to download from our own server, we&#8217;re telling it to download from wordpress.org.</p>
<p>We do this by using the <code>pre_set_site_transient_update_plugins</code> filter to hook into the <code>update_plugins</code> transient and add our plugin back into the list of plugins WP is thinking about. </p>
<p>As well as this, we are adding a series of steps into a message at the top of every page in the admin area. These steps tell the user what they need to do to complete the process. </p>
<p>First, we link straight to the update link for the plugin. That won&#8217;t do anything without us hijacking the <code>update_plugins</code> transient. But with that other code block in place, WordPress will allow the update to proceed. Because it&#8217;s an update, not an installation, it won&#8217;t be put off by finding the folder in place. It will delete it (bye bye folder containing the entire plugin repo!), then install the plugin from .org (or whichever URL we added).
</p>
<p>Next, we tell the user to Activate the plugin.</p>
<p>Finally, we need the user to get rid of the code added to functions.php. To help them do this, we provide a link to the Theme Editor, with the functions.php file open and the scroll to parameter set to 100000, which should place them at the bottom of the file (in all but the most extreme cases!), right where the code they need to remove is located. We need to make it easy for them, so that they actually remove it. Of course, the message will stay there forever unless they remove the code, which is a good incentive for them to remove it.
</p>
<h2>Final Thoughts</h2>
<p>So, am I crazy? What would you do if you were in this situation: a) provide them the code above; b) tell them to use FTP; or c) something else? </p>
<p>Also, you should totally <a href="https://twitter.com/StephenCronin">follow me on Twitter</a>, so you can hear about more embarrassing stories that happen to, um, a friend of mine&#8230;</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>5 Years On &#8211; A Personal Reflection On WordCamp Gold Coast</title>
		<link>http://scratch99.com/wordpress/opinion/5-years-personal-reflection-wordcamp-gold-coast/</link>
					<comments>http://scratch99.com/wordpress/opinion/5-years-personal-reflection-wordcamp-gold-coast/#comments</comments>
		
		<dc:creator><![CDATA[Stephen Cronin]]></dc:creator>
		<pubDate>Fri, 04 Nov 2016 23:00:09 +0000</pubDate>
				<category><![CDATA[WordPress Opinion]]></category>
		<category><![CDATA[community]]></category>
		<category><![CDATA[wordcamp]]></category>
		<guid isPermaLink="false">http://scratch99.com/?p=866</guid>

					<description><![CDATA[I&#8217;ve been using using and developing on WordPress for almost 10 years. In all that time, the single most important (WordPress related) thing to happen to me was WordCamp Gold Coast 2011, which was held 5 years ago today. And it&#8217;s not just because it was the first time I got my name on a&#8230;<p><a class="more-link" href="http://scratch99.com/wordpress/opinion/5-years-personal-reflection-wordcamp-gold-coast/" title="Continue reading &#8216;5 Years On &#8211; A Personal Reflection On WordCamp Gold Coast&#8217;">Continue reading <span class="meta-nav">&#8594;</span></a></p>]]></description>
										<content:encoded><![CDATA[<p>I&#8217;ve been using using and developing on WordPress for almost 10 years. In all that time, the single most important (WordPress related) thing to happen to me was <a href="https://2011.goldcoast.wordcamp.org/">WordCamp Gold Coast 2011</a>, which was held 5 years ago today.</p>
<p><span id="more-866"></span></p>
<p>And it&#8217;s not just because it was the first time I got my name on a shirt either!</p>
<div id="attachment_867" style="width: 800px" class="wp-caption alignnone"><img aria-describedby="caption-attachment-867" loading="lazy" class="size-large wp-image-867" src="http://scratch99.com/wp-content/uploads/2016/10/WordCamp-Gold-Coast-1024x559.png" alt="WordCamp Gold Coast T-shirt" width="790" height="431" srcset="http://scratch99.com/wp-content/uploads/2016/10/WordCamp-Gold-Coast-1024x559.png 1024w, http://scratch99.com/wp-content/uploads/2016/10/WordCamp-Gold-Coast-500x273.png 500w, http://scratch99.com/wp-content/uploads/2016/10/WordCamp-Gold-Coast-768x419.png 768w" sizes="(max-width: 790px) 100vw, 790px" /><p id="caption-attachment-867" class="wp-caption-text">WordCamp Gold Coast T-shirt (<a href="https://2011.goldcoast.wordcamp.org/files/2011/10/WordCamp-Shirt.png">source</a>)</p></div>
<p>For me it was a turning point in my WordPress journey and 5 years on I decided to reflect on it&#8217;s importance to me.</p>
<h2>Confession Time</h2>
<p>Right from the moment I started using WordPress, I was building plugins and bending it to my will. I was far from a great developer, but I had a feeling that I could make WordPress do anything!</p>
<p>I only rarely met people locally who knew what WordPress was and their knowledge of WordPress was pretty limited.</p>
<p>The only people I knew who were good with WordPress were those I&#8217;d met online, who were all overseas. I&#8217;d heard of Dion Hulse, who&#8217;d been given core commit access, but it felt like there weren&#8217;t many WordPress developers in Australia.</p>
<p>Not only was I isolated, I had developed what can probably only be called Reverse Imposter Syndrome. I was overconfident in my WordPress skills and to be honest I came into WordCamp Gold Coast thinking I was sort of good. :O</p>
<h2>Turning Point</h2>
<p>Of course, WordCamp Gold Coast taught me that there were a load of great WordPress developers here, including people much cleverer than me. In fact, the Imposter Syndrome quickly reasserted itself and has steadily been growing worse since then!</p>
<p>While I could probably do without the Imposter Syndrome, it was a turning point for me. WordCamp Gold Coast let me realise that there was a passionate local WordPress community here, that I wasn&#8217;t alone, that there were others like me out there. And it was the start of many friendships for me.</p>
<p>I was no longer isolated, I&#8217;d found my WordPress family.</p>
<h2>The Organisers</h2>
<p>WordCamp Gold Coast was not only my first WordCamp, it was also my first time as a WordCamp Speaker, which was to become an important part of my self identity for a few years.</p>
<p>I guess I have that Reverse Imposter Syndrome to thank for giving me enough confidence to apply to talk! However, the people I really need to thanks are the organisors, all of whom were supportive, helpful and encouraging:</p>
<ul>
<li>Bronson Quick</li>
<li>Lachlan McPherson</li>
<li>Dion Hulse</li>
<li>Brent Shepherd</li>
</ul>
<p>I proposed several crazy ideas for talks and they basically said &#8220;No, what we really want you to talk about is WordPress and Government&#8221;. I&#8217;m so glad they did that, because in hindsight, that was <a href="http://scratch99.com/wordpress/government/wordcamp-gold-coast-2011/">an important talk</a> and worked far better than the other topics I had in mind.</p>
<p>So, 5 years on, another shout out to the organisers: Thanks guys! I owe you so much.</p>
<h2>Finding My WordPress Family</h2>
<p>As well as the organisers, I met a bunch of other great people, all of whom I feel honoured to know: Dee Teal. Anthony Horton. Ryan McCue. Luke Carbis. Troy Dean. Brian Miyaji and AylaView from ThemeBoy. Dan Petrovic. Anthony Cole. Dan Milward (though I only met him that once).</p>
<p>And of course Japh Thomson, who told me a little about this company Envato that he worked for, starting me on the path to joining them myself years later.</p>
<p>I also got to meet John O Nolan, who doesn&#8217;t get a lot of love in the WordPress community these days, except from those who&#8217;ve actually met him. John gave a talk (sadly not recorded) that still ranks as the best I&#8217;ve heard. In return, we made sure John was educated on the dangers of drop bears and Yowies.</p>
<p>And so many others. I love the Australian WordPress community and this is where it all started for me.</p>
<h2>A Funny Story</h2>
<p>Well, this probably <strong>isn&#8217;t</strong> funny, but it tickles me..</p>
<p>During my talk, I mentioned a problem I&#8217;d been having working with the Twitter API. Someone tweeted me a solution while I was still talking. This person had a flying dog as a Twitter avatar and I didn&#8217;t immediately match it up to the young guy I met at the speakers dinner.</p>
<p>When I finally worked it out, at the after party I think, I told him he really should change his avatar to a photo so people could recognize him. I believe I may have preached that this was important for personal branding.</p>
<p>Of course he kept the flying dog avatar, which many in the WordPress Community would now recognise instantly, and totally proved me wrong in that regard. So much for my career as a branding expert!</p>
<h2>Your First WordCamp Will Always Be Your Favourite</h2>
<p>For me anyway! This little WordCamp (maybe 170 attendees) has a place in my heart that none other can replace.</p>
<p>I&#8217;ve been lucky enough to go to WordCamp San Francisco (the last one) and WordCamp US (the first one) and a couple of Pressnomics and a bunch of Australian WordCamps &#8211; and I&#8217;ve loved them all! Yet WordCamp Gold Coast will always be the one that is most special to me.</p>
<p>Of course, it wasn&#8217;t really the WordCamp itself that made it so special &#8211; it was meeting and becoming part of this WordPress Australia community that I love so much. The second half of my WordPress career has been so much more rewarding than the first half and it all started right there.</p>
<h2>Final Thoughts</h2>
<p>So that&#8217;s my story. I&#8217;m interested in hearing yours! What was your first WordCamp and how did it affect you? If you write about it, please feel free to leave a link in the comments below as I&#8217;d love to read it.</p>
<p>If you were hoping to get a reflection of what happened at WordCamp GoldCoast, instead of this sentimental stuff, check out <a href="http://maddisondesigns.com/2011/11/wordcamp-gold-coast-2011-wcgold/">Anthony Horton&#8217;s blog post</a> from back in 2011.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://scratch99.com/wordpress/opinion/5-years-personal-reflection-wordcamp-gold-coast/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>Two Years At Envato</title>
		<link>http://scratch99.com/about/two-years-envato/</link>
		
		<dc:creator><![CDATA[Stephen Cronin]]></dc:creator>
		<pubDate>Thu, 05 May 2016 15:27:43 +0000</pubDate>
				<category><![CDATA[About]]></category>
		<category><![CDATA[Envato]]></category>
		<guid isPermaLink="false">http://scratch99.com/?p=790</guid>

					<description><![CDATA[Today marks two years since I joined Envato. Those two years have disappeared in a whirlwind, with so much happening in that time. I decided to pause for a moment, to look back at some of the highs and the lows. *Photo blatantly &#8216;borrowed&#8217; from Envato&#8217;s website I&#8217;ve been really happy in my job and&#8230;<p><a class="more-link" href="http://scratch99.com/about/two-years-envato/" title="Continue reading &#8216;Two Years At Envato&#8217;">Continue reading <span class="meta-nav">&#8594;</span></a></p>]]></description>
										<content:encoded><![CDATA[<p>Today marks two years since I joined Envato. Those two years have disappeared in a whirlwind, with so much happening in that time. I decided to pause for a moment, to look back at some of the highs and the lows.</p>
<p><span id="more-790"></span></p>
<p><img loading="lazy" src="http://scratch99.com/wp-content/uploads/2016/05/envato-office.png" alt="Photo of the entry to Envato&#039;s Melbourne office" width="872" height="400" class="size-full wp-image-797" srcset="http://scratch99.com/wp-content/uploads/2016/05/envato-office.png 872w, http://scratch99.com/wp-content/uploads/2016/05/envato-office-500x229.png 500w" sizes="(max-width: 872px) 100vw, 872px" /><small>*Photo blatantly &#8216;borrowed&#8217; from <a href="http://inside.envato.com/envato-office-tour/">Envato&#8217;s website</a></small></p>
<p>I&#8217;ve been really happy in my job and there have been many highs, including: </p>
<ul class="long-list">
<li>Working for an awesome company. Envato has <a href="http://careers.envato.com/#values-NGp8b0yoa">great values</a> and it lives by them. I&#8217;ve seen big decisions made that were true to those values, rather than being best for the bottom line. Envato also does a lot around diversity and inclusiveness, both internally and externally and is just generally cool. I&#8217;m proud to work at Envato.</li>
<li>Working with great people! Every single person I&#8217;ve met within the company is great and they are always willing to help out. It&#8217;s lead from the top &#8211; Collis is far more open, approachable and humble than any CEO has a right to be &#8211; and goes right through the company. I want to give a special mention to the ThemeForest and CodeCanyon reviewers, a super passionate bunch who I work with day in and day out. Their job is not an easy one and they don&#8217;t get much appreciation from anyone outside the company, but they put their heart and their soul into it. </li>
<li>The job itself, which I love. I&#8217;ve been able to work on some truly challenging issues that impact a large portion of the Internet. I&#8217;m really appreciative of that opportunity. Also, I&#8217;m never, ever, bored. There always some new challenge being thrown at us.</li>
<li>Being able to attend events overseas, which has without a doubt been an enormous highlight. I&#8217;ve been lucky enough to attend the last WordCamp San Francisco, the first WordCamp US and Pressnomics 3 &amp; 4. That&#8217;s given me the chance to meet so many awesome people that I knew of online, but would never have met otherwise. Great people, great times!</li>
<li>My work being more closely aligned with my passions, specifically WordPress, than my previous job. I do miss working on some of the other web disciplines (content strategy, SEO, analytics, usability, etc), but absolutely no regrets on this!</li>
<li>Working from home, which has given me more flexibility to be there for my family. There is a trade-off in that I&#8217;m away some of the time, but all things considered, I&#8217;d make that trade-off any day. I&#8217;m actually far more present in their lives than when I used to catch the train to the city in the morning and get back just before their bed time.</li>
</ul>
<p>Of course, there have been lows too:</p>
<ul class="long-list">
<li>Large security issues. There have been others, but the Slider Revolution one was the first and wow, that was intense. There were a lot of challenges to work through in a short time and a lot of focus on us while we were doing it. In some ways, the experience of working on the problem was a positive: I like challenges and we had a great team working on it; but because of the effect it had on so many people, it has to be a huge negative. I will say  the author, <a href="https://www.themepunch.com/">ThemePunch</a>, were great to work with in very trying circumstances.</li>
<li>The limited amount of change I&#8217;ve been able to affect. I came into Envato with a list of things I wanted to address and a load of ideas, but many of these never came to light. I hadn&#8217;t anticipated the volume of urgent and complex issues that come up as part of everyday business. These need to be dealt with, which takes attention away from the projects I&#8217;d like to see happen. I&#8217;ve had to be largely reactive, rather than proactive, in my role. The good news is that this has been recognised and there are plans to address this.</li>
<li>Not being able to speak at or organise WordCamps. I spoke at the first three WordCamps I attended and it came to be an important part of my self-identity. Sadly, WordCamp rules prevent Envato employees from speaking at WordCamps, or organising them, even if all of their WordPress products are 100% GPL (as mine are). I won&#8217;t lie &#8211; that&#8217;s been hard to take at times. <span style='font-family:"Courier New", Courier, monospace;'>;_;</span></li>
<li>Side Projects: Unfortunately, most of my side projects have stalled or been severely limited. When I&#8217;m at my computer in the evening, I&#8217;m more likely to be tempted to work (because I enjoy it) or to keep up with what&#8217;s going on in the WordPress world (which has been an unofficial part of my job until James Giroux <a href="http://inside.envato.com/meet-envatos-wordpress-evangelist/">joined us earlier this year</a>). I&#8217;m trying to change this and to spend more time on my side projects. Maybe I&#8217;ll even resurrect this blog. No promises on that though. <img src="https://s.w.org/images/core/emoji/13.0.1/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></li>
</ul>
<p>And there you go&#8230; I&#8217;ve probably missed some things, but all in all, I&#8217;m loving it and I&#8217;m looking forward to the next two years (or more!). </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Themes, Users And The WP REST API</title>
		<link>http://scratch99.com/wordpress/opinion/themes-users-wp-rest-api/</link>
					<comments>http://scratch99.com/wordpress/opinion/themes-users-wp-rest-api/#comments</comments>
		
		<dc:creator><![CDATA[Stephen Cronin]]></dc:creator>
		<pubDate>Thu, 12 Nov 2015 05:47:10 +0000</pubDate>
				<category><![CDATA[WordPress Opinion]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wordpress themes]]></category>
		<category><![CDATA[wp rest api]]></category>
		<guid isPermaLink="false">http://scratch99.com/?p=718</guid>

					<description><![CDATA[There is mounting excitement over the WP REST API being added to core and rightly so! It is going to fundamentally change the WordPress landscape and open up all sorts of new possibilities. Developers are drooling over all the cool stuff they are going to be able to build. Exciting times! But&#8230; When it comes&#8230;<p><a class="more-link" href="http://scratch99.com/wordpress/opinion/themes-users-wp-rest-api/" title="Continue reading &#8216;Themes, Users And The WP REST API&#8217;">Continue reading <span class="meta-nav">&#8594;</span></a></p>]]></description>
										<content:encoded><![CDATA[<p>There is mounting excitement over the WP REST API being added to core and rightly so! It is going to fundamentally change the WordPress landscape and open up all sorts of new possibilities. Developers are drooling over all the cool stuff they are going to be able to build. Exciting times!</p>
<p>But&#8230;</p>
<p>When it comes to using the REST API with themes, it may not always be the best choice.</p>
<p><span id="more-718"></span></p>
<h2>TLDR</h2>
<p>If you&#8217;re building themes for your own site or for a large client with a dedicated web team, go knock yourself with all the coolness you can build with the REST API.</p>
<p>If you&#8217;re building themes that will be distributed or will be used by small to medium clients that don&#8217;t have dedicated support, then you need to ask yourself if using the REST API is really the best thing for your users. Chances are you&#8217;ll be making their lives harder.</p>
<p><!--CTBSTART1-->Note: I&#8217;m not talking about standard themes that just use the REST API for Ajax requests. That&#8217;s fine. I&#8217;m talking about themes that do things radically differently.<!--CTBEND1--></p>
<h2>Background</h2>
<p>I&#8217;ve been writing this post for more than a year. It started off as a post about why using Twig/Timber in distributed WordPress themes may be problematic, but the same issues exist for the REST API too. </p>
<p>Given the relative exposure of each of these, I changed the topic to the REST API a few months ago. There are many posts coming out now covering all the thing that you <strong>can</strong> do with the REST API and almost none covering what you <strong>shouldn&#8217;t</strong> do. In these situations, bandwagons are jumped and people start using things just because they can, even when it may not be the best choice. </p>
<p>Listening to <a href="https://poststatus.com/using-wordpress-as-an-application-framework-draft-podcast/">an episode</a> of the Post Status podcast the other day was the final push for me to finish off this post. They were talking about Twig/Timber (and Genesis), but many of the same issues will apply to themes built with the REST API. In fact, I decided to widen the scope of this article to include custom themes built for a client, after listening to their discussion.</p>
<h2>A Story</h2>
<p>I&#8217;m going to pause for a moment and tell you a story.</p>
<p>I used to run government websites. When I started, things were done in a government centric way. The websites told people what the government wanted to say, not what people actually needed. There was loads of information about what government had done. Profiles of staff. That sort of thing. Have you ever had to use a site like this to get something done? Not easy.</p>
<p>In 2010, I joined a new team. One that was building a Whole of Government website that was, gasp, user centric! We researched what users actually needed and gave it to them! When people wanted to publish content that users didn&#8217;t care about, we could tell them no! It took a while for the business areas to get their head around why it was important, but eventually they worked out that <em>the site was only successful if met the users&#8217; needs</em>. </p>
<p>The point? It&#8217;s never good to lose sight of what the users need or to start putting your own needs first. Just because you <strong>can</strong> build a theme with the REST API doesn&#8217;t mean you <strong>should</strong>. You need to ask whether it&#8217;s right for your users &#8211; in this case the site owners who use your theme on their website? Is using the REST API helping meet their needs &#8211; or hurting them? </p>
<h2>Reality Check</h2>
<p>The REST API is super exciting to most of us. Every second WordCamp talk is about it.* Every second episode of the Post Status podcast is about it.**<br />
<small>*this statistic may be made up</small><br />
<small>**actually I think this one is true!</small></p>
<p>But here&#8217;s the thing: The vast majority of users don&#8217;t care about the REST API. Yes, even when we are talking about site owners rather than site visitors. They care about their business needs being met. </p>
<p>If the REST API helps with that, they&#8217;ll be happy. If it gets in the way, they won&#8217;t be happy. Either way they won&#8217;t care about the REST API itself, just what it means for them in terms of meeting their business goals.</p>
<h2>Meet Joan And Bob</h2>
<p>Meet Joan. She owns a pest control company with 6 employees. She knows that having a website is crucial for the business, so several years ago she got a local web development shop to rebuild the site. She paid a lot of money ($8,000!) but was really happy with it, especially the custom theme they built. That company went out of business and she&#8217;s still looking for a replacement. She&#8217;s not in a rush. After all, WordPress is easy and neice can help her out.</p>
<p>Meet Bob. He just started a tutoring business on the side of his day job. He wanted a website, but doesn&#8217;t have much money to spend on it. He doesn&#8217;t know much about web development, but he knows his way around a computer, so he decided to go the &#8216;do it yourself&#8217; route: he got a cheap Hostgator account, installed WordPress, downloaded a free theme from wordpress.org and set it up himself.</p>
<p>Joan and Bob have some things in common:</p>
<ul>
<li>They&#8217;ve both heard that having a blog, rather than just a brochure-ware site, can help get them more business &#8211; so they&#8217;ve both decided to blog daily! </li>
<li>They both use themes that make heavy use of the REST API. </li>
<li>Neither theme has one of those fancy author boxes at the bottom of the post. They both want one!</li>
</ul>
<p>What did they do? They both googled &quot;how to add author info in wordpress&quot; and clicked the first result. That took them to a <a href="http://www.wpbeginner.com/wp-tutorials/how-to-add-an-author-info-box-in-wordpress-posts/">WPBeginner post</a> telling them how to do it. Step 1: Add some CSS to style.css. A bit tricky, but they both managed it. Step 2: They just have to do the following:</p>
<blockquote>
<p>open your single.php and add this code inside your loop.</p>
</blockquote>
<p>Hang on&#8230; There is no loop. Maybe there isn&#8217;t even a single.php. Hmm, this WordPress thing isn&#8217;t as easy as people say&#8230; <img src="https://s.w.org/images/core/emoji/13.0.1/72x72/1f641.png" alt="🙁" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<h2>Examples</h2>
<p>Here are some examples of how Joan and Bob would go following those instructions with some real REST API themes:</p>
<ul>
<li>Jack Lenox&#8217;s <a href="https://github.com/jacklenox/picard-present">Picard Present theme</a>: There is no single.php. </li>
<li>Chris Hutchinson&#8217;s <a href="https://github.com/chrishutchinson/twentysixteen-rr">REST + React version</a> of Twenty Sixteen: There is no single.php. </li>
<li>Human Made&#8217;s <a href="https://github.com/humanmade/feelingrestful-theme">Feeling Restful theme</a>: There is no single.php. </li>
</ul>
<p>Game over&#8230; </p>
<p>Don&#8217;t get me wrong &#8211; these themes are great work that are pushing things foward! But they are not for Joan or Bob and we need to remember that.</p>
<h2>A Cornerstone Of WordPress&#8217; Success</h2>
<p>One of the strengths of WordPress, which has helped get us to the 25% market share point, is that it&#8217;s so easy to tweak and to get help with. Not sure how to do something? Don&#8217;t worry. There are millions of &#8216;how to&#8217; posts out there. Can&#8217;t get in contact with your old web developer? No worries. There are hundreds of thousands of developers out there who understand how WordPress works.</p>
<p>Community support is a cornerstone of WordPress&#8217; popularity. However, that&#8217;s built on things being done in a fairly standard way. As we enter the exciting new world, some of that will be eroded. </p>
<p>For users with a non traditional theme, many of those tutorials won&#8217;t work and they may need to get a more experienced developer to help them. Help will still be there, but it won&#8217;t be quite as accessible. For some users, this won&#8217;t be a problem. For many others, it will be.</p>
<p>We need to remember to <a href="https://wordpress.org/about/philosophy/#majority">design for the majority</a>. Most WordPress users don&#8217;t know or care about the REST API. Many don&#8217;t have enough money to pay experienced developers to look after their site. Many will try to tweak the theme themselves at some point.</p>
<h2>Using The REST API In Themes</h2>
<p>I&#8217;m not saying &quot;never use the REST API in WordPress themes&quot;. If there is a <strong>genuine need</strong>, then by all means use it! Just use it appropriately, keeping <strong>your</strong> users in mind. </p>
<p>If you do use it, then make sure you clearly communicate that with your users. If you&#8217;re developing themes for WordPress.org or a marketplace, make sure your documentation explains to users what they should expect. Try to keep the structure fairly standard and provide good comments in your code (or get ready for those support requests!). If you&#8217;re developing a custom theme for a client who may one day change to a different developer, do the same. </p>
<p>Both WordPress.org and marketplaces should consider how they make it clear to buyers what they are getting (ie flag to users that REST API themes are somewhat different). Neither wants to promote confusion. Marketplaces also have refunds to consider. There will always be power users who will understand what they are getting and need that &#8211; but that&#8217;s not the majority.</p>
<h2>Final Thoughts</h2>
<p>It&#8217;s straightforward really. Put your users&#8217; needs first. Use the REST API when it&#8217;s appropriate. Don&#8217;t just use it because it&#8217;s cool! Maybe this is just common sense, but it needs to be said.</p>
<p>Do you agree? Disagree? Did I miss something? Let me know in the comments.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://scratch99.com/wordpress/opinion/themes-users-wp-rest-api/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
		<item>
		<title>Backwards Compatibility For Site Icons In WordPress 4.3</title>
		<link>http://scratch99.com/wordpress/development/backwards-compatibility-site-icons/</link>
		
		<dc:creator><![CDATA[Stephen Cronin]]></dc:creator>
		<pubDate>Thu, 27 Aug 2015 14:59:21 +0000</pubDate>
				<category><![CDATA[WordPress Development]]></category>
		<guid isPermaLink="false">http://scratch99.com/?p=685</guid>

					<description><![CDATA[When WordPress 4.3 was released, it added the ability for users to set a site icon, also known as a favicon, in the Customizer. In the past, users had to either add this manually, through a plugin, or through the theme options (if their theme included this functionality). In this post, I&#8217;m looking at the&#8230;<p><a class="more-link" href="http://scratch99.com/wordpress/development/backwards-compatibility-site-icons/" title="Continue reading &#8216;Backwards Compatibility For Site Icons In WordPress 4.3&#8217;">Continue reading <span class="meta-nav">&#8594;</span></a></p>]]></description>
										<content:encoded><![CDATA[<p>When WordPress 4.3 was released, it added the ability for users to set a site icon, also known as a favicon, in the Customizer. In the past, users had to either add this manually, through a plugin, or through the theme options (if their theme included this functionality).</p>
<p>In this post, I&#8217;m looking at the last of those scenarios. What should theme authors do now that WordPress itself offers the equivalent functionality?</p>
<p><span id="more-685"></span></p>
<h2>What Theme Authors Should Do</h2>
<p>If you&#8217;re a theme author, you should probably start planning to remove your theme&#8217;s favicon code. There&#8217;s no point duplicating what is now in WordPress core, unless you are extending it in some way, and this is probably one of those things that doesn&#8217;t have a lot of scope for extension. </p>
<p>Also, note this from the <a href="https://make.wordpress.org/core/2015/07/27/site-icon/">Site Icons announcement post</a>: </p>
<blockquote>
<p>Site Icons work out of the box, are theme independent, and don’t require theme support.</p>
</blockquote>
<p>That means that if a user goes into the Customizer and adds a site icon, it&#8217;s code is going to be added to the source, right next to your favicon code. It&#8217;ll look like this (the first 4 lines of favicon code come from core, the last 2 come from the theme):</p>
<div id="attachment_686" style="width: 870px" class="wp-caption alignnone"><img aria-describedby="caption-attachment-686" loading="lazy" src="http://scratch99.com/wp-content/uploads/2015/08/site-icon-duplicate-code.png" alt="Both the core site icon code and the theme&#039;s favicon code appear in the source" width="860" height="207" class="size-full wp-image-686" srcset="http://scratch99.com/wp-content/uploads/2015/08/site-icon-duplicate-code.png 860w, http://scratch99.com/wp-content/uploads/2015/08/site-icon-duplicate-code-500x120.png 500w" sizes="(max-width: 860px) 100vw, 860px" /><p id="caption-attachment-686" class="wp-caption-text">Both the core site icon code and the theme&#8217;s favicon code appear in the source</p></div>
<p>Not good! So you should be removing your favicon code. However, I think it makes sense for this to be done in a backwards compatible manner. </p>
<h2>Backwards Compatibility</h2>
<p>Rather than just ripping your theme&#8217;s favicon right out of the theme, you should probably keep it for users who can&#8217;t yet use site icons. There are two parts to this: </p>
<ol>
<li>Allowing a user to add a favicon via theme options</li>
<li>Outputting the code for the favicon to the page</li>
</ol>
<p>Ideally we want to allow both of these for versions of WordPress prior to 4.3. </p>
<p>For users on 4.3, we want to restrict the use of number 1, getting them to add their favicon via site icons instead. However for number 2, we should probably keep outputting the favicon code until the user sets up a site icon (more on this later).</p>
<h2>Input &#8211; Adding A Favicon Via Theme Options</h2>
<p>Some of your users are probably not on WordPress 4.3 yet and won&#8217;t be able to use the site icons feature. To provide those users with your favicon theme option, but to prevent users on 4.3 from using it, you&#8217;d do something like this:</p>
<p>[sourcecode language=&#8221;php&#8221;]<br />
// if the `wp_site_icon` function does not exist (ie we&#8217;re on &lt; WP 4.3)<br />
if ( ! function_exists( &#8216;wp_site_icon&#8217; ) ) {<br />
    // show the user your favicon theme option<br />
}<br />
else {<br />
    // display a message advising the user to use the site icon feature<br />
}<br />
[/sourcecode]</p>
<p>This shows the theme&#8217;s favicon option to users who are on versions of WordPress older than 4.3. Users who are on WordPress 4.3 or above will be told to use the site icon feature. The message telling the user to user the site icon feature is a nicety to be sure. You could leave the else statement out and just not display anything (but you may get more support requests that way).</p>
<h2>Output &#8211; Adding Favicon Code To The Source</h2>
<p>Right, we&#8217;ve stopped people using your theme&#8217;s favicon option when they have the core site icon feature available. Now we need to control the output of your theme&#8217;s favicon code. </p>
<p>There&#8217;s a temptation to use the same if statement as above, checking for the existence of <code>wp_site_icon</code>, but there is a problem with this. This only checks whether the user is on WordPress 4.3 or above, it doesn&#8217;t check whether the user has actually set up the site icon.</p>
<p>If they haven&#8217;t then WordPress won&#8217;t be outputting any favicon code. By wrapping your favicon code in <code>if ( ! function_exists( 'wp_site_icon' ) )</code>, your theme won&#8217;t be outputting any favicon code either.</p>
<p>End result: The site icon will be added to the page if it exists, but the theme&#8217;s favicon code will only be output on versions prior to 4.3. Users on 4.3 without the site icon set will have no favicon code on the page at all.</p>
<div id="attachment_687" style="width: 570px" class="wp-caption alignnone"><img aria-describedby="caption-attachment-687" loading="lazy" src="http://scratch99.com/wp-content/uploads/2015/08/site-icon-no-code.png" alt="Neither the core site icon code or the theme&#039;s favicon code appear in the source" width="560" height="111" class="size-full wp-image-687" srcset="http://scratch99.com/wp-content/uploads/2015/08/site-icon-no-code.png 560w, http://scratch99.com/wp-content/uploads/2015/08/site-icon-no-code-500x99.png 500w" sizes="(max-width: 560px) 100vw, 560px" /><p id="caption-attachment-687" class="wp-caption-text">Neither the core site icon code or the theme&#8217;s favicon code appear in the source</p></div>
<p>The problem? Users will update to WordPress 4.3 and all of a sudden their favicon will disappear. Many will not realise that they need to re-add their favicon as a site icon. Bad for the user, bad for the length of your support queue.</p>
<p>Fortunately WordPress 4.3 gives us the <code>has_site_icon</code> function, which tells us whether a site icon has been set up or not. So we can use this code instead:</p>
<p>[sourcecode language=&#8221;php&#8221;]// If the `has_site_icon` function doesn&#8217;t exist (ie we&#8217;re on &lt; WP 4.3) or if the site icon has not been set<br />
if ( ! ( function_exists( &#8216;has_site_icon&#8217; ) &amp;&amp; has_site_icon() ) ) {<br />
  // output your theme favicon code to the page source<br />
}<br />
[/sourcecode]</p>
<p>This outputs the theme&#8217;s favicon code only if the user has not set a site icon (or if they are on versions of WordPress older than 4.3). If they have set a site icon, then the theme&#8217;s favicon code will not be included in the page, so there will be no duplication. </p>
<div id="attachment_688" style="width: 870px" class="wp-caption alignnone"><img aria-describedby="caption-attachment-688" loading="lazy" src="http://scratch99.com/wp-content/uploads/2015/08/site-icon-favicon-code-appears.png" alt="Now only the theme&#039;s favicon code appears" width="860" height="143" class="size-full wp-image-688" srcset="http://scratch99.com/wp-content/uploads/2015/08/site-icon-favicon-code-appears.png 860w, http://scratch99.com/wp-content/uploads/2015/08/site-icon-favicon-code-appears-500x83.png 500w" sizes="(max-width: 860px) 100vw, 860px" /><p id="caption-attachment-688" class="wp-caption-text">Now only the theme&#8217;s favicon code appears</p></div>
<p>End result: There will always be one set of favicon code on the page. Priority will be given to the core site icon if it&#8217;s set, falling back to the theme&#8217;s favicon code if necessary.</p>
<h2>What Theme Authors Shouldn&#8217;t Do</h2>
<p>It is possible to remove the Site Icon section from the Customizer. I strongly recommend you don&#8217;t do that. This feature will be standard across all WordPress installations and removing it will only confuse people. </p>
<h2>Final Thoughts</h2>
<p>Now that site icons are in core, themes should be phasing out their favicon functionality. By using the code above to provide backwards compatibility, we can ensure that end users have a smooth transition from the old method to the new, without their favicon being lost. </p>
<p>There may be an alternative point of view that we should just let things break, as that will drive awareness and adoption of the new core feature (and encourage people to update). There will also be those who say, it&#8217;s just a favicon! </p>
<p>Both are right to a degree, but personally I think backwards compatibility is more important. What do you think? </p>
<p><!--CTBSTART1-->Note: Credit goes to <a href="https://twitter.com/kailoon">Kailoon Chan</a> who had a long discussion with me about this, helping me polish these ideas. <!--CTBEND1--></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Jeff &#8211; This One&#8217;s For You</title>
		<link>http://scratch99.com/wordpress/opinion/thanks-jeff/</link>
		
		<dc:creator><![CDATA[Stephen Cronin]]></dc:creator>
		<pubDate>Sun, 04 Jan 2015 05:43:15 +0000</pubDate>
				<category><![CDATA[WordPress Opinion]]></category>
		<guid isPermaLink="false">http://scratch99.com/?p=574</guid>

					<description><![CDATA[I&#8217;m writing this post because of the very sad passing of Kim Parsell, but it&#8217;s not going to be about her. Much has already been said by people who knew her far better than I. I only met Kim briefly at WordCamp San Francisco last year and didn&#8217;t really know her. I do know that&#8230;<p><a class="more-link" href="http://scratch99.com/wordpress/opinion/thanks-jeff/" title="Continue reading &#8216;Jeff &#8211; This One&#8217;s For You&#8217;">Continue reading <span class="meta-nav">&#8594;</span></a></p>]]></description>
										<content:encoded><![CDATA[<p>I&#8217;m writing this post because of the very sad passing of <a href="https://twitter.com/kimparsell">Kim Parsell</a>, but it&#8217;s not going to be about her. <a href="http://sarahpressler.com/time-ran-short/">Much</a> has <a href="https://blog.dembowski.net/2015/thank-you-wpmom-for-everything/">already</a> been <a href="http://www.carriedils.com/for-you-kim/">said</a> by people who knew her far better than I. <span id="more-574"></span> I only met Kim briefly at WordCamp San Francisco last year and didn&#8217;t really know her. I do know that she was a valued member of our community, who contributed selflessly and who meant a lot to a great number of people. RIP Kim &#8211; you will be missed.</p>
<p>Instead this post is about a guy called <a href="http://jeffc.wordpress.com/">Jeff Chandler</a>, a website called <a href="http://wptavern.com/">WP Tavern</a> and a podcast called <a href="http://wptavern.com/wordpress-weekly">WP Weekly</a>. </p>
<p>I learnt of Kim&#8217;s passing through the tweets of Jeff who&#8217;d been at the centre of this sad story (at least at the very end of it). Upon reflection, I realised that I first came across Kim back in 2009 when she was on the <a href="http://t.co/rp2KLTymMP">WP Weekly podcast</a>, created and hosted by Jeff. She appeared on a number of episodes and came across as very knowledgeable and likeable. And I got to know who she was because of Jeff (and her willingness to step up and get involved).</p>
<p>Further reflection lead me to realise that Jeff, the Tavern and WP Weekly have been at the centre of an awful lot of what&#8217;s gone on in the community over the years. The big stories and the little. Too many to name. </p>
<p>I&#8217;ve been a part of the WordPress community for a while now. Not a big part admittedly, but I&#8217;ve been sitting in my little corner since 2007. And in that time, I&#8217;ve learnt more about what&#8217;s going on in the community through Jeff than any one else. Yes he&#8217;s taken the odd hiatus or two, but for the most part he&#8217;s been there throughout, putting himself into the community with heart, body and soul.</p>
<p>The community has grown and there&#8217;s a lot happening in spaces around the edges, so its hard for anyone to be across everything, but for me, Jeff is still at the centre of it all. I still learn more about what&#8217;s going on from him than anyone else. I&#8217;ve always appreciated that, but today I appreciate it more than ever.</p>
<p>Jeff, this one&#8217;s for you. At the moment, the focus is on Kim and rightly so, but it&#8217;s also time to give you a shout out. Thanks for being there over the years at the centre of the community. You&#8217;ve obviously been through a lot in the last couple of days, but please know that you mean a lot to many of us in the community. Thanks Jeff.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>The Business Case For Bloat</title>
		<link>http://scratch99.com/wordpress/opinion/jetpack-business-case-for-bloat/</link>
		
		<dc:creator><![CDATA[Stephen Cronin]]></dc:creator>
		<pubDate>Thu, 18 Dec 2014 13:57:09 +0000</pubDate>
				<category><![CDATA[WordPress Opinion]]></category>
		<guid isPermaLink="false">http://scratch99.com/?p=564</guid>

					<description><![CDATA[Editorial Note 16 Feb 2015: This post attempted to answer the &#8216;why&#8217; of Jetpack&#8217;s bloat. On 23 January 2015, at Pressnomics, Matt Mullenweg talked about Jetpack being the reason that WordPress wasn&#8217;t in decline and a key factor in the fight against WordPress&#8217;s competitors. Although I don&#8217;t necessarily agree with this or that it makes&#8230;<p><a class="more-link" href="http://scratch99.com/wordpress/opinion/jetpack-business-case-for-bloat/" title="Continue reading &#8216;The Business Case For Bloat&#8217;">Continue reading <span class="meta-nav">&#8594;</span></a></p>]]></description>
										<content:encoded><![CDATA[<div id="editorial-note">
<strong>Editorial Note</strong><br />
16 Feb 2015: This post attempted to answer the &#8216;why&#8217; of Jetpack&#8217;s bloat. On 23 January 2015, at Pressnomics, Matt Mullenweg talked about Jetpack being <a href="http://wptavern.com/how-important-is-jetpack-on-wordpress-road-to-50-market-share">the reason that WordPress wasn&#8217;t in decline</a> and a key factor in the fight against WordPress&#8217;s competitors. Although I don&#8217;t necessarily agree with this or that it makes Jetpack&#8217;s approach okay, I do absolutely believe that Matt believes this very strongly. It actually validates most of this post &#8211; although I now believe the driver is helping to grow the platform, rather than simple business benefits for Automattic.</div>
<p>Recently, there has been some discussion around whether Jetpack is bloated. Hmm, actually, we&#8217;ve been talking about that for years&#8230; Anyway, the interesting part to me isn&#8217;t <strong>whether</strong> Jetpack is bloated, it&#8217;s <strong>why</strong> Jetpack is bloated.</p>
<p><span id="more-564"></span></p>
<h2>Disclaimers</h2>
<p>I need to point out that these are <strong>my</strong> <em>opinions</em>, formed over many years, and are in no way endorsed by the company I work for (Envato). That&#8217;s always the case with this site, but I&#8217;ll make it extra clear for this post.</p>
<p>I&#8217;ll also clarify upfront that this is just about Jetpack. I like Matt Mullenweg and Automattic and are grateful for the amount of effort they put into the project and the community. I like the people who work at Automattic. I think a lot of the features included in Jetpack are brilliant. But personally, I don&#8217;t like the philosophy behind putting all these features in one plugin.</p>
<p>It&#8217;s not good when you have to start a post with a bunch of disclaimers like that, but I really don&#8217;t want people to take this the wrong way! In fact, <a href="https://twitter.com/StephenCronin/status/553387799731126272">I almost</a> didn&#8217;t publish this.</p>
<h2>The Discussion</h2>
<p>A few weeks ago, Eric Mann wrote an article titled <a href="https://eamann.com/tech/bundling-bloatware/">Bundling and Bloatware</a>, where he essentially argues that Jetpack is bloated. There is a great debate in the comments, including a passionate defence (yes it comes across as a defence) from some of the Jetpack team. Set aside half an hour and go read it all.</p>
<p>Not long afterwards, Sam Hotchkiss wrote up <a href="https://bruteprotect.com/the-jetpack-bloat-myth/">some tests</a> showing Jetpack is actually faster than using other plugins to do the same jobs. Matt Mullenweg then <a href="http://ma.tt/2015/01/jetpack-speed/">briefly wrote about it</a>, linking to Sam&#8217;s post. Interesting comments in both those places as well.</p>
<h2>So Is It Bloated Or Not?</h2>
<p>In my opinion, yes. I have no doubt it is very well coded and it&#8217;s been proven not to be slow, but in terms of features, its, well &#8230; bloated.</p>
<p>I&#8217;ll concede that it&#8217;s better to have a well coded, bloated product than a poorly coded, minimalistic product. It&#8217;s important to note that there are some very good developers in the Jetpack team and I have no doubt the code is solid. Still&#8230;</p>
<p>Philosophically, I prefer products that try to solve a single problem really well. I don&#8217;t like products that try to solve many, unrelated problems. I think it would be better for Jetpack to be a series of plugins, allowing people to only install the ones they need.</p>
<h2>The WordPress Philosophy</h2>
<p>From the <a href="https://wordpress.org/about/philosophy/#clean">Clean, Lean, and Mean</a> section of the WordPress Philosophy:</p>
<blockquote><p>We are constantly asked &#8220;when will X feature be built&#8221; or &#8220;why isn&#8217;t X plugin integrated into the core&#8221;. The rule of thumb is that the core should provide features that 80% or more of end users will actually appreciate and use. If the next version of WordPress comes with a feature that the majority of users immediately want to turn off, or think they&#8217;ll never use, then we&#8217;ve blown it. If we stick to the 80% principle then this should never happen.</p></blockquote>
<p>If you were to judge Jetpack by that statement, you would have to say they&#8217;ve &#8216;blown it&#8217;. I understand that was written for core and doesn&#8217;t have to be followed for a plugin, but it seems the philosophy adopted by Jetpack is diametrically opposed to the WordPress Philosophy. Personally, I think we should all follow the WordPress philosophy as closely possible.</p>
<p>In the <a href="https://eamann.com/tech/bundling-bloatware/#comment-46434">comments of Eric&#8217;s post</a>, George Stephanis, the Jetpack lead, says:</p>
<blockquote><p>If you disable a feature, the code isn’t included. It isn’t loaded. It isn’t run. How is that harming you in any way?</p></blockquote>
<p>But if that&#8217;s true, then why do we try to keep stuff out of core? Why bother? Lets add a basic contact form to core, let&#8217;s add custom CSS, Markdown support, XML sitemaps etc. They don&#8217;t harm anybody if they are disabled, so lets add them! To be clear, I&#8217;m not actually suggesting we do this. I&#8217;m just highlighting the philosophical disconnect between Jetpack and WordPress itself.</p>
<h2>Hang On, Aren&#8217;t You The ThemeForest Guy?</h2>
<p>Yep. And yes, there are themes for sale on ThemeForest that are bloated. I don&#8217;t like those either. Would I like them to trim down? Yes! Am I holding my breath? No. Just like I&#8217;m not holding my breath for Jetpack to start stripping features out.</p>
<p>I regularly get into discussions around theme bloat and I always argue that themes should keep things simple, rather than including loads of features. There are a variety of arguments I use, one of which is encouraging people to follow the WordPress Philosophy in their products.</p>
<p>Occasionally I get the push-back: &#8220;Well Automattic don&#8217;t follow it with Jetpack, why should we&#8221;? It&#8217;s deflating to have that thrown at you. It&#8217;s hard to tell someone they shouldn&#8217;t add lots of features into a theme when Automattic is busy adding lots of features into a plugin.</p>
<p>Note, this is purely about features, not code quality or best practice. We don&#8217;t want functionality in themes either. If a theme must have a load of features, then it should be through integrations with plugins, etc.</p>
<h2>Why Is Jetpack Bloated?</h2>
<p>So far, I&#8217;ve just rehashed the same old discussion about <strong>whether</strong> Jetpack is bloated. I&#8217;m sure that will just result in the same arguments for and against, so let move on to the main point of this article: to answer <strong>why</strong> Jetpack is bloated.</p>
<p>Whenever you listen to Matt, or George or Jeremy Herve talk about why Jetpack has so many features, they always say they are doing this to help the users. To quote <a href="https://eamann.com/tech/bundling-bloatware/#comment-46443">Jeremy</a>:</p>
<blockquote><p>your life is still way easier when you don’t have to worry about 30 plugins, because one plugin comes bundled with everything you need to get started. That’s what some of the people I help every day like about Jetpack.</p></blockquote>
<p>Interestingly, that is very similar to what theme authors say: that their research shows that end users just want to install a theme that comes bundled with everything they need, they don&#8217;t want to have to find and install a bunch of other plugins.</p>
<p>In both cases, people are saying it&#8217;s for the end user. I do think they genuinely believe that. And I agree that&#8217;s what end users want (although personally I think that&#8217;s not what&#8217;s best for them). But there is more to this equation than that &#8211; there is also a business element.</p>
<h2>The Business Case For Bloat</h2>
<p>The bottom line: The more value you provide, the more likely it is that someone will use your product.</p>
<p><strong>Users often conflate value and features, so simply adding more features make it more likely they will use your product.</strong> They don&#8217;t even have to be particularly useful features (though Jetpack&#8217;s are). Oh, having a good product is important, as is good support, etc, but (sadly) great marketing of features will take you a long way.</p>
<p>For theme authors, having more features means that more people will buy their theme, which equals more $.</p>
<p>Jetpack follows a different business model &#8211; it&#8217;s free but with up-sells on premium features. I&#8217;m guessing we&#8217;ll see more and more commercial elements in Jetpack in the future. Regardless, the economics are the same: the more features in Jetpack, the more people will use it, which equals more $.</p>
<p>Why is Jetpack so important to Automattic? This is purely supposition, but wordpress.org users represent a huge market and presumably Automattic want access to that market. They can&#8217;t do that through core. The next best thing is a plugin &#8211; but how do they get everyone to download it? Providing lots of value &#8211; and lots of features.</p>
<p>If Automattic had released Jetpack as 33 different plugins, as much as that would have made me happy, it would not have given them the leverage or user base that a mega-plugin gives them. Although I personally don&#8217;t like the bloat, I can see that it makes a lot of sense from a business perspective.</p>
<h2>None Of This Is New</h2>
<p>The thing is, what I&#8217;m saying isn&#8217;t new. Remember WPCandy? Well they <a href="http://wpcandy.com/thinks/jetpack-means-more-than-features-for-dot-org-users/#.VJJo8iuUdRa">said a lot of this</a> almost 4 years ago, not long after JetPack launched:</p>
<blockquote><p>I don’t mean to downplay what the Automattic folks have been saying about wanting to bring .com features to .org users. I believe they want that too; their altruism is, I believe, honest. But there is a very strong business component to this decision as well.</p></blockquote>
<p>I think Ryan nailed it way back then. Automattic are trying to improve the world with Jetpack, but there are also some important business drivers with it as well.</p>
<h2>Final Thoughts</h2>
<p>This debate is not going away any time soon. Those people who think Jetpack is bloated aren&#8217;t going to be convinced by any of the arguments to the contrary and Jetpack&#8217;s not going to start trimming down its feature set.</p>
<p>When arguing about this however, it&#8217;s important we understand that it&#8217;s not really about philosophy or best practice &#8211; it&#8217;s about business. And Jetpack is here to stay.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Half Of All Existing WordPress Sites Vulnerable</title>
		<link>http://scratch99.com/wordpress/opinion/half-existing-wordpress-sites-vulnerable/</link>
					<comments>http://scratch99.com/wordpress/opinion/half-existing-wordpress-sites-vulnerable/#comments</comments>
		
		<dc:creator><![CDATA[Stephen Cronin]]></dc:creator>
		<pubDate>Fri, 21 Nov 2014 15:53:00 +0000</pubDate>
				<category><![CDATA[WordPress Opinion]]></category>
		<category><![CDATA[security]]></category>
		<guid isPermaLink="false">http://scratch99.com/?p=560</guid>

					<description><![CDATA[Scary post title right? Well, I wish it was link bait, but it&#8217;s not. This is really serious. Yesterday, it was announced that there was a critical security vulnerability with versions 3.0 to 3.9.2 of WordPress. You can read more about what you should do on the Envato Market Blog and full details of the&#8230;<p><a class="more-link" href="http://scratch99.com/wordpress/opinion/half-existing-wordpress-sites-vulnerable/" title="Continue reading &#8216;Half Of All Existing WordPress Sites Vulnerable&#8217;">Continue reading <span class="meta-nav">&#8594;</span></a></p>]]></description>
										<content:encoded><![CDATA[<p>Scary post title right? Well, I wish it was link bait, but it&#8217;s not. This is really serious.</p>
<p>Yesterday, <a href="https://wordpress.org/news/2014/11/wordpress-4-0-1/">it was announced</a> that there was a critical security vulnerability with versions 3.0 to 3.9.2 of WordPress.<br />
<span id="more-560"></span></p>
<p>You can read more about what you should do on the <a href="http://marketblog.envato.com/general/wordpress-security-vulnerability/">Envato Market Blog </a> and full details of the vulnerability are given on <a href="http://klikki.fi/adv/wordpress.html">Jouko Pynnonen’s website</a> (Jouku discovered the issue).</p>
<p>In a nutshell, the vulnerability allows an attacker to inject JavaScript into a post just by leaving a comment (although the JavaScript has to be formatted in a certain way). That JavaScript code will then be executed on any subsequent page load containing that comment, both on the front end and in the comment moderation queue in the back end.</p>
<p>Here&#8217;s a video showing how easy it is to exploit the vulnerability:</p>
<p><iframe loading="lazy" width="790" height="444" src="http://www.youtube.com/embed/rC4NjBa4DnQ?feature=oembed" frameborder="0" allowfullscreen></iframe></p>
<p>In the video, I just redirected the page to Google&#8217;s home page. Any vistor trying to access that page is going to end up at Google. I could have done stuff that&#8217;s a whole lot worse than that, but that&#8217;s bad enough&#8230;</p>
<p>Now, this didn&#8217;t affect verison 4.0 (although there were some other fixes for that). Websites using 3.9.*, 3.8.* and 3.7.* should have been updated automatically to a secure version by now (asuming automatic updates are turned on). However, versions 3.0 to 3.6.1 are unsupported, so there is no update for those versions. </p>
<p>Well that&#8217;s not so bad you&#8217;re thinking. Can&#8217;t be many people using those old versions.</p>
<p>Wrong. A series of tweets from <a href="http://www.rarst.net/">Rarst</a> lead me to have a good look at the <a href="https://wordpress.org/about/stats/">stats page</a> on WordPress.org. This is what it shows:</p>
<p><img loading="lazy" src="http://scratch99.com/wp-content/uploads/2014/11/WordPress-Versions.png" alt="image showing the percentage of use for each version of WordPress" width="390" height="272" class="alignnone size-full wp-image-561" /></p>
<p>Look at it. Now look at it again. Right&#8230; so more than half the WordPress sites out there are on 3.6 or older. More than half of all existing WordPress sites are vulnerable. That&#8217;s roughly 12% of the web. I said this was really serious.</p>
<p>This just goes to show how important the Automatic Update functionality is. I was originally a skeptic, but I now consider it one of the most important features ever added to WordPress. Thanks to the devs who did the hard work to implement it (looking at you Dion)!</p>
<p>Unfortunately, there are still a bucket load of sites out there just waiting to be exploited. We can&#8217;t have more than half of all WordPress sites just sitting out there as timebombs. I don&#8217;t think this is one we can let pass quietly. We need to spread the word and get people to update their old sites. Everyone should be on 4.0.1.</p>
<p>If you have any old sites out there, make sure they are updated! If you have clients or friends who might have old sites, get them to update! </p>
<p>Does anyone out there have any contacts at Google? They send out emails to Webmaster Tools users telling them to update WordPress. Perahaps they could send a special email given how serious this and how widespread this is. </p>
<p>Does anyone have any other ideas?</p>
]]></content:encoded>
					
					<wfw:commentRss>http://scratch99.com/wordpress/opinion/half-existing-wordpress-sites-vulnerable/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Filtering Output From I Make Plugins</title>
		<link>http://scratch99.com/wordpress/hacks/filtering-i-make-plugins/</link>
		
		<dc:creator><![CDATA[Stephen Cronin]]></dc:creator>
		<pubDate>Fri, 07 Mar 2014 13:44:25 +0000</pubDate>
				<category><![CDATA[WordPress Hacks]]></category>
		<guid isPermaLink="false">http://scratch99.com/?p=495</guid>

					<description><![CDATA[If you create free WordPress plugins then you almost certainly host them on the official WordPress Plugin Directory. You probably also have a home page for them on your own site. But that means keeping both the readme.txt file and your own site up to date with changes. Hassle&#8230; Wouldn&#8217;t it be good if you&#8230;<p><a class="more-link" href="http://scratch99.com/wordpress/hacks/filtering-i-make-plugins/" title="Continue reading &#8216;Filtering Output From I Make Plugins&#8217;">Continue reading <span class="meta-nav">&#8594;</span></a></p>]]></description>
										<content:encoded><![CDATA[<p>If you create free <a href="http://scratch99.com/products/">WordPress plugins</a> then you almost certainly host them on the <a href="http://wordpress.org/plugins/">official WordPress Plugin Directory</a>. You probably also have a home page for them on your own site. But that means keeping both the readme.txt file and your own site up to date with changes. Hassle&#8230;<br />
<span id="more-495"></span><br />
Wouldn&#8217;t it be good if you could just update the readme.txt file and have your site update automatically from that? You can, using Mark Jaquith&#8217;s <a href="http://wordpress.org/plugins/i-make-plugins/">I Make Plugins</a> plugin. From the plugin description:</p>
<blockquote><p>It showcases your plugins on your WordPress blog, using the WordPress.org plugin repository as a source. It generates both a directory listing page, and the content of each plugin&#8217;s page. All you have to provide is the title; the rest comes from the repository. You get to control the markup of each type of page using intuitive WordPress shortcodes.</p></blockquote>
<p>I recently decided not to have out of date plugin pages, so I made the switch to I Make Plugins. It&#8217;s straight forward to set up, but I needed to tweak a few things to improve the user experience. They&#8217;re listed below, just in case they are of use to anyone (or I need them again!).</p>
<h2>Swapping Links To The Current Page</h2>
<p>First a screenshot:</p>
<div id="attachment_496" style="width: 711px" class="wp-caption alignnone"><a href="http://scratch99.com/wp-content/uploads/2014/03/i-make-plugins.png"><img aria-describedby="caption-attachment-496" loading="lazy" src="http://scratch99.com/wp-content/uploads/2014/03/i-make-plugins.png" alt="Screenshot of page on my site created using I Make Plugins by Mark Jaquith" width="701" height="371" class="size-full wp-image-496" srcset="http://scratch99.com/wp-content/uploads/2014/03/i-make-plugins.png 701w, http://scratch99.com/wp-content/uploads/2014/03/i-make-plugins-500x264.png 500w" sizes="(max-width: 701px) 100vw, 701px" /></a><p id="caption-attachment-496" class="wp-caption-text">Page on my site created using I Make Plugins by Mark Jaquith</p></div>
<p>Notice the link in the paragraph? Along with the rest of the content, this is pulled in from the readme.txt in the Directory. It links to the plug home page on my site. Wait, that&#8217;d be the same page that the screenshot was taken on. It&#8217;s linking to itself! </p>
<p>That&#8217;s not the end of the world, but it could be confusing to users. I&#8217;d much rather it link to the WordPress Directory page. Fortunately, that&#8217;s pretty straight forward to do. Simply add the following code to functions.php or a <a href="http://wpcandy.com/teaches/how-to-create-a-functionality-plugin/">functionality plugin</a>:</p>
<p>[sourcecode language=&#8221;php&#8221;]<br />
function scratch99_i_make_plugins( $content ) {<br />
	global $post;<br />
	return str_replace( get_permalink(), &#8216;http://wordpress.org/plugins/&#8217; . $post-&gt;post_name, $content );<br />
}<br />
add_filter( &#8216;cws_imp_plugin_body&#8217;, &#8216;scratch99_i_make_plugins&#8217; );<br />
[/sourcecode]</p>
<p>The <code>cws_imp_plugin_body</code> filter allows us to target the content of the page after I Make Plugins has created it. It calls a function where we attempt to replace any links to the current page with a link to the Directory page. </p>
<p>In that function, we use <code>get_permalink()</code> as the string to search for. That will search for the full URL, which is exactly what we want. It will only find exact matches, it won&#8217;t find other (lower level) URLs starting with the URL of this page. </p>
<p>If it finds any matching links in <code>$content</code>, it replaces them with the link to the WordPress Directory URL and returns the result. The WordPress Directory URL is built by adding the <code>post_name</code> field for this page to <code>http://wordpress.org/plugins/</code>. Because I Make Plugins matches the readme.txt file based on the same field, this should always work (unless wordpress.org change their URL structure). </p>
<p>If no matching links are found, it will return $content unchanged.</p>
<p>And that&#8217;s it. The link in the screenshot above has changed from <code>http://scratch99.com/products/fix-duplicates/</code> to <code>http://wordpress.org/plugins/fix-duplicates</code>.</p>
<h2>Adding ID Attributes To Elements</h2>
<p>I need to be able to link directly to certain parts of the plugin home page, using the id attribute. For example, I want to be able to link straight to the Support section by adding #support to the end of the URL for the plugin home page. </p>
<p>That&#8217;s not in the HTML created by I Make Plugins, but once again this is easy to do. I&#8217;ve extended the code above to achieve this:</p>
<p>[sourcecode language=&#8221;php&#8221;]<br />
function scratch99_i_make_plugins( $content ) {<br />
	global $post;<br />
	$content = str_replace( get_permalink(), &#8216;http://wordpress.org/plugins/&#8217; . $post-&gt;post_name, $content );<br />
	$content = str_replace( &#8216;&lt;h4&gt;Support&lt;/h4&gt;&#8217;, &#8216;&lt;h4 id=&quot;support&quot;&gt;Support&lt;/h4&gt;&#8217;, $content );<br />
	return $content;<br />
}<br />
add_filter( &#8216;cws_imp_plugin_body&#8217;, &#8216;scratch99_i_make_plugins&#8217; );<br />
[/sourcecode]</p>
<p>We&#8217;re now manipulating the <code>$content</code> variable over a couple of lines before returning it. Line 3 is essentially the same as above. Line 4 searches for the particular HTML string you&#8217;re targeting (in this case <code>'&lt;h4>Support&lt;/h4>'</code>) and then replaces it with the altered string with the id attribute added. Obviously you need to know the exact HTML that will be in the page, but this should be easy to predict given you are creating the readme.txt file.</p>
<p><!--CTBSTART1-->Note: If anyone is wondering how I added the plugin submenu shown in the screenshot, I simply filtered the_content and pre-pended it to the front. But that&#8217;s a story for another day&#8230;<!--CTBEND1--></p>
<p>That&#8217;s just a couple of examples of how the output of I Make Plugins can be tweaked. You can take the same approach to do a whole lot more. Let me know what you do.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
