<?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>PHP Archives - ClickedyClick</title>
	<atom:link href="https://gergely.imreh.net/blog/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>https://gergely.imreh.net/blog/tag/php/</link>
	<description>Life in real, complex and digital.</description>
	<lastBuildDate>Mon, 04 Jul 2022 05:44:19 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>100 Days to Offload WordPress Plugin</title>
		<link>https://gergely.imreh.net/blog/2022/07/100-days-to-offload-wordpress-plugin/</link>
					<comments>https://gergely.imreh.net/blog/2022/07/100-days-to-offload-wordpress-plugin/#comments</comments>
		
		<dc:creator><![CDATA[Gergely Imreh]]></dc:creator>
		<pubDate>Mon, 04 Jul 2022 05:44:17 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[100DaysToOffload]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[wordpress plugin]]></category>
		<guid isPermaLink="false">https://gergely.imreh.net/blog/?p=2650</guid>

					<description><![CDATA[<p>Made a WordPress plugin to see how far off am I towards my 100 blogposts a year project.</p>
<p>The post <a href="https://gergely.imreh.net/blog/2022/07/100-days-to-offload-wordpress-plugin/">100 Days to Offload WordPress Plugin</a> appeared first on <a href="https://gergely.imreh.net/blog">ClickedyClick</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">In the course of pushing myself to write more on this blog, I&#8217;ve come across the <a href="https://100daystooffload.com/">#100DaysToOffload</a> project. It&#8217;s super simple: write a 100 blogposts in a year in your personal blog to unlock the achievement. It seems like gamification done to the right level, as it&#8217;s not to strenuous (&#8220;write every day&#8221; would likely fail before lift-off), and not too lax (100 blogpost are still quite a stretch to go!). Thus it looked like the right too to trick myself into doing the thing I already wanted.</p>



<p class="wp-block-paragraph">On the other hand, I&#8217;m one for meta-games, especially when I have doubts whether I stand a chance in the game itself, thus came the idea of do <em>something</em> around 100DaysToOffload that might also result in a blogpost. Hence came the &#8220;Hundred Days to Offload&#8221; WordPress Plugin idea: get a bit of coding in, make something useful to see if the game has been &#8220;won&#8221;, an also get one (or more) write-ups out of it.</p>



<p class="wp-block-paragraph">Spoiler alert: it&#8217;s working now, very barebones, but to the point&#8230; that there&#8217;s a long way to go.</p>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1024" height="477" src="https://gergely.imreh.net/blog/wp-content/uploads/2022/07/hundred-days-to-offload-interface-1024x477.png" alt="Screenshot of the Hundred Days to Offload plugin in the WordPress admin interface." class="wp-image-2656" srcset="https://gergely.imreh.net/blog/wp-content/uploads/2022/07/hundred-days-to-offload-interface-1024x477.png 1024w, https://gergely.imreh.net/blog/wp-content/uploads/2022/07/hundred-days-to-offload-interface-500x233.png 500w, https://gergely.imreh.net/blog/wp-content/uploads/2022/07/hundred-days-to-offload-interface-768x358.png 768w, https://gergely.imreh.net/blog/wp-content/uploads/2022/07/hundred-days-to-offload-interface-1200x559.png 1200w, https://gergely.imreh.net/blog/wp-content/uploads/2022/07/hundred-days-to-offload-interface.png 1210w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption>How the Hundred Days to Offload plugin looks in practice (as of now).</figcaption></figure>



<p class="wp-block-paragraph">In the process, that took a couple of days over the weekend, I&#8217;ve revisited PHP, that I used to &#8220;play&#8221; with for projects before, though haven&#8217;t done anything serious, nor made it part of my <a href="https://gergely.imreh.net/blog/tag/lotm/">Language of the Month series</a>, so far. It was still quite interesting to revisit with more mature eyes of e.g. how good projects look like in the Python ecosystem (where I spend most of my time), and whether lessons learned there are applicable here.</p>



<span id="more-2650"></span>



<h2 class="wp-block-heading">The Making of a WordPress Plugin</h2>



<p class="wp-block-paragraph">The plugin itself is pretty straightforward: query WordPress for all the post that were published in the last 1 year, and count them. <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f9ee.png" alt="🧮" class="wp-smiley" style="height: 1em; max-height: 1em;" /> It could be slightly more complicated, if the goal would be more closely aligned to the &#8220;100 days to offload&#8221; name, that is if one would have to count <em>the number of unique days on which posts were made</em>, but let&#8217;s not move the goal-posts here.</p>



<p class="wp-block-paragraph">Starting from the relevant <a href="https://developer.wordpress.org/plugins/">WordPress Handbook page</a> I could have an initial stab at laying out a plugin project structure, though I have to say, that the examples are not going too far in helping with that. This was augmented by a <a href="https://github.com/topics/wordpress-plugin">GitHub wordpress-plugin topic search</a>, where I could work from examples a lot better, and see some (maybe too many) best (or at least reasonable) practices.</p>



<p class="wp-block-paragraph">This lead me to various ecosystem tooling such as </p>



<ul class="wp-block-list"><li><a href="https://getcomposer.org/">Composer</a>, the PHP dependency manager that I didn&#8217;t know before, and could very much relate to (with it&#8217;s prod/dev dependencies, scripts definitions, etc, reminding me of <a href="https://python-poetry.org/">Poetry</a> for Python a bit in spirit)</li><li><a href="https://phpstan.org/">PHPStan</a> static analysis tool, and its &#8220;fun times&#8221; with WordPress code (which can be fixed by various stub projects, etc),</li><li>all the &#8220;code standards&#8221; tools that do various fixes (while not being quite a linter and code formatted, but still being a little), for example <a href="https://github.com/WordPress/WordPress-Coding-Standards">wpcs</a>. This latter had a fun side effect that have to work from its cutting edge &#8220;develop&#8221; branch to work with PHP 8.1 that I had at hand, so definitely learned through that a few Composer quirks.</li></ul>



<p class="wp-block-paragraph">In the end I had my little snippet of code, run through all these codes, fixed up tabs vs spaces, docs strings, types for return values, dependencies, <em>actual</em> bugs of wrong input types to various PHP functions, and also some best practices (which might or might not apply to my little code). It&#8217;s a rabbit hole that could go a lot deeper, though, so cutting a release version at a point. The rest goes <a href="https://github.com/imrehg/hundred-days-to-offload-wordpress/issues">into an issue tracker</a> to pick up one day.</p>



<p class="wp-block-paragraph">And now, with an MVP (minimum viable plugin;) at hand, I&#8217;ve <a href="https://wordpress.org/plugins/developers/add/">submitted</a> for review. That&#8217;s just the cherry on the top, or start of new problems with a project to support. Either way I can use the plugin checked out with git just fine.</p>



<figure class="wp-block-image size-large"><img decoding="async" src="https://gergely.imreh.net/blog/wp-content/uploads/2022/07/Screenshot-2022-07-04-at-11.09.18-1024x484.png" alt="" class="wp-image-2651"/><figcaption>Plugin submission, <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f91e.png" alt="🤞" class="wp-smiley" style="height: 1em; max-height: 1em;" /> to see what happens</figcaption></figure>



<p class="wp-block-paragraph">I&#8217;ve definitely picked up <em>a tiny bit</em> of PHP for now, even if mostly accidentally, and likely full of bugs and bad practices. It&#8217;s still interesting, and a learning experience. For example data handling is a source of many, various pains in all languages I&#8217;ve across so far. The PHP way (or WordPress way?) of object orientation is also just scratched on the surface and accepted as it goes, but not from a point of solid understanding.</p>



<h2 class="wp-block-heading">Looking to the future</h2>



<p class="wp-block-paragraph">From the plugin&#8217;s side it would be good to add some style and looks, as it&#8217;s super dummy and bare bones. But how should it look? Time to learn a bit of design and/or run some user testing? The mixing of HTML and code is also particularly mind-bending (or awkward, or intriguing, or&#8230;), I would need to look where to set the right boundaries for that, as there could be many.</p>



<p class="wp-block-paragraph">Adding CI/CD as well, so definitely various PHP versions can be tested (seems easy), and potentially various WordPress versions as well (seems a lot more hairy) could be a practice and baseline.</p>



<p class="wp-block-paragraph">Adding some settings to change would help me to learn more plugin development, though this particular plugin might not benefit a lot from it.</p>



<p class="wp-block-paragraph">Work out how to do proper translations / i18n would be probably pretty solid benefit as well, and that needs a lot more digging (variable texts are not straightforward to translate).</p>



<p class="wp-block-paragraph">Finally, all of these improvements might also just make a few extra blogposts to get towards my 100 Days to Offload. <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/270d.png" alt="✍" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>The post <a href="https://gergely.imreh.net/blog/2022/07/100-days-to-offload-wordpress-plugin/">100 Days to Offload WordPress Plugin</a> appeared first on <a href="https://gergely.imreh.net/blog">ClickedyClick</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://gergely.imreh.net/blog/2022/07/100-days-to-offload-wordpress-plugin/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Object Caching 19/28 objects using APC
Page Caching using Disk: Enhanced 
Lazy Loading (feed)

Served from: gergely.imreh.net @ 2026-06-25 14:13:25 by W3 Total Cache
-->