<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Dave Kellam</title>
    <description>The latest articles on DEV Community by Dave Kellam (@davekellam).</description>
    <link>https://dev.to/davekellam</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1051645%2F16466760-f14a-4e21-8f3a-baba6990ad70.png</url>
      <title>DEV Community: Dave Kellam</title>
      <link>https://dev.to/davekellam</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/davekellam"/>
    <language>en</language>
    <item>
      <title>Five For the Future at Plank</title>
      <dc:creator>Dave Kellam</dc:creator>
      <pubDate>Wed, 23 Aug 2023 14:49:45 +0000</pubDate>
      <link>https://dev.to/plank/five-for-the-future-at-plank-50mo</link>
      <guid>https://dev.to/plank/five-for-the-future-at-plank-50mo</guid>
      <description>&lt;p&gt;&lt;a href="https://plank.co" rel="noopener noreferrer"&gt;Plank&lt;/a&gt; is one of over &lt;a href="https://wordpress.org/five-for-the-future/pledges/" rel="noopener noreferrer"&gt;150 organizations&lt;/a&gt; that have pledged to contribute to &lt;a href="https://wordpress.org/five-for-the-future/" rel="noopener noreferrer"&gt;Five For the Future&lt;/a&gt;. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Launched in 2014, Five for the Future encourages organizations to contribute 5% of their resources to WordPress development. This benchmark was proposed by WordPress co-founder Matt Mullenweg to maintain a "golden ratio" of contributors to users. Participation in the community has more than quadrupled since launch.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;At Plank, we believe in open-source software. We use it to power all of our projects. So many others have contributed to making our lives easier and more productive, it's important that we do the same!&lt;/p&gt;

&lt;p&gt;We’ve begun our Five For the Future journey by contributing to the &lt;a href="https://make.wordpress.org/documentation/" rel="noopener noreferrer"&gt;documentation&lt;/a&gt; and &lt;a href="https://make.wordpress.org/polyglots/" rel="noopener noreferrer"&gt;polyglots&lt;/a&gt; teams. The polyglots team is a natural fit for us, as our team members speak various languages, including English, French, Spanish and Arabic. We’ll be looking to expand our involvement in the near future by attending &lt;a href="https://us.wordcamp.org/2023/contributor-day/" rel="noopener noreferrer"&gt;contributor day&lt;/a&gt; at WordCamp US 2023. &lt;/p&gt;

&lt;p&gt;Visit our &lt;a href="https://wordpress.org/five-for-the-future/pledge/plank/" rel="noopener noreferrer"&gt;pledge&lt;/a&gt; to see our contributions to the project so far!&lt;/p&gt;




&lt;p&gt;&lt;a href="https://www.flickr.com/photos/wceu/53076418323/in/album-72177720310091678/" rel="noopener noreferrer"&gt;Photo&lt;/a&gt; from contributor day at WordCamp Europe 2023.&lt;/p&gt;

</description>
      <category>wordpress</category>
      <category>development</category>
      <category>opensource</category>
    </item>
    <item>
      <title>WordPress Playground</title>
      <dc:creator>Dave Kellam</dc:creator>
      <pubDate>Tue, 27 Jun 2023 19:14:08 +0000</pubDate>
      <link>https://dev.to/plank/wordpress-playground-2ig0</link>
      <guid>https://dev.to/plank/wordpress-playground-2ig0</guid>
      <description>&lt;p&gt;One of the most exciting things at &lt;a href="https://europe.wordcamp.org/2023/" rel="noopener noreferrer"&gt;WordCamp Europe 2023&lt;/a&gt; for me was discovering how far along the &lt;a href="https://developer.wordpress.org/playground/" rel="noopener noreferrer"&gt;WordPress Playground&lt;/a&gt; project is. If you haven’t heard of the playground before, it’s a full version of WordPress, running directly in your browser!&lt;/p&gt;

&lt;h2&gt;
  
  
  History
&lt;/h2&gt;

&lt;p&gt;The project began &lt;a href="https://make.wordpress.org/core/2022/09/23/client-side-webassembly-wordpress-with-no-server/" rel="noopener noreferrer"&gt;late last summer&lt;/a&gt;, with version 0.1 being released in April. The readme indicates that it was inspired by the initial PHP WASM implementation,  a Drupal in the browser example, and a &lt;a href="https://wasmlabs.dev/articles/wordpress-in-the-browser/" rel="noopener noreferrer"&gt;WASM Labs WordPress demo&lt;/a&gt;. The WordPress Playground was introduced to the larger WordPress community during the &lt;a href="https://www.hostinger.com/blog/state-of-the-word-2022#WordPress_Playground" rel="noopener noreferrer"&gt;2022 State of the Word&lt;/a&gt; presentation. &lt;/p&gt;

&lt;p&gt;The Playground was actively promoted during WCEU this year — used to quickly spin up sites for the &lt;a href="https://dev.to/cgarofalo/contributor-day-at-wceu23-in-athens-15c1"&gt;documentation team&lt;/a&gt;, and others,  on &lt;a href="https://wordpress.github.io/wordpress-playground/wordcamp-contributor-day/" rel="noopener noreferrer"&gt;contributor day&lt;/a&gt;, featured in a &lt;a href="https://europe.wordcamp.org/2023/wp-connect/" rel="noopener noreferrer"&gt;connect track&lt;/a&gt; session, and a &lt;a href="https://youtu.be/7Nmz3IjtPh0?t=374" rel="noopener noreferrer"&gt;demo during the keynote.&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;p&gt;The technology behind the Playground is called WASM, short for &lt;a href="https://webassembly.org/" rel="noopener noreferrer"&gt;Web Assembly&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;WebAssembly (abbreviated Wasm) is a binary instruction format for a stack-based virtual machine. Wasm is designed as a portable compilation target for programming languages, enabling deployment on the web for client and server applications.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There are versions of PHP compiled into WASM binaries that allow you to run PHP code directly in the browser. The Playground then uses those binaries to &lt;a href="https://wordpress.github.io/wordpress-playground/architecture/wordpress" rel="noopener noreferrer"&gt;run the WordPress PHP application&lt;/a&gt;, as well as a plugin that allows MySQL calls to be intercepted and interpreted to SQLite&lt;/p&gt;

&lt;h2&gt;
  
  
  Demos
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgfknl4sn4a2y961nbbmf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgfknl4sn4a2y961nbbmf.png" alt="Screenshot of the Playground with Frost Theme" width="800" height="388"&gt;&lt;/a&gt;WordPress Playground with Frost theme installed&lt;/p&gt;

&lt;p&gt;Unfortunately, you can’t embed playground iframes in dev.to, but we can link directly to a few examples of it in action. The &lt;a href="https://playground.wordpress.net" rel="noopener noreferrer"&gt;Playground default&lt;/a&gt; uses the latest version of WordPress with the default theme and PHP 8.0. &lt;/p&gt;

&lt;p&gt;You can use query parameters, like &lt;code&gt;theme&lt;/code&gt; and &lt;code&gt;plugins&lt;/code&gt; to install a particular theme or plugin in the Playground. In &lt;a href="https://playground.wordpress.net/?theme=frost&amp;amp;plugin=coblocks" rel="noopener noreferrer"&gt;this example&lt;/a&gt;, we install the Frost theme and CoBlocks plugin. You can also pass &lt;code&gt;wp&lt;/code&gt; and &lt;code&gt;php&lt;/code&gt; to install different versions of WordPress and PHP.&lt;/p&gt;

&lt;p&gt;If you’re embedding an iframe, the experience is also totally &lt;a href="https://wordpress.github.io/wordpress-playground/javascript-api/index" rel="noopener noreferrer"&gt;scriptable&lt;/a&gt;. One example of the iframes in action is the &lt;a href="https://adamadam.blog/2023/02/16/how-to-modify-html-in-a-php-wordpress-plugin-using-the-new-tag-processor-api/" rel="noopener noreferrer"&gt;tutorial&lt;/a&gt; for using the new tag processor function.&lt;/p&gt;

&lt;h2&gt;
  
  
  The future
&lt;/h2&gt;

&lt;p&gt;The Playground opens up a lot of possibilities since it makes WordPress embeddable in so many areas: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We can easily test different versions of WordPress and PHP&lt;/li&gt;
&lt;li&gt;We can &lt;a href="https://jonathanbossenger.com/2023/06/19/testing-out-the-wp-playground-interactive-code-block/" rel="noopener noreferrer"&gt;embed live examples&lt;/a&gt; in tutorials and lessons&lt;/li&gt;
&lt;li&gt;A &lt;a href="https://marketplace.visualstudio.com/items?itemName=WordPressPlayground.wordpress-playground" rel="noopener noreferrer"&gt;VS Code extension&lt;/a&gt; allows you to open a theme or plugin up in a usable test environment&lt;/li&gt;
&lt;li&gt;It can be embedded directly in &lt;a href="https://twitter.com/adamzielin/status/1669478239771799552" rel="noopener noreferrer"&gt;mobile apps&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;We can include live demos in pull requests&lt;/li&gt;
&lt;li&gt;It can be integrated into a CI/CD pipeline&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;a href="https://github.com/WordPress/wordpress-playground/issues/472" rel="noopener noreferrer"&gt;vision and philosophy&lt;/a&gt; and &lt;a href="https://github.com/WordPress/wordpress-playground/issues/525" rel="noopener noreferrer"&gt;roadmap&lt;/a&gt; are both available on GitHub, so you can see where things are headed. It’s still early on, version 0.2 was just released a few days ago on June 24th. We’re likely to see breaking changes at times until an official 1.0 release happens.&lt;/p&gt;

&lt;p&gt;Now it’s time to go &lt;a href="https://wordpress.github.io/wordpress-playground/" rel="noopener noreferrer"&gt;play&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>wordpress</category>
      <category>php</category>
      <category>webassembly</category>
    </item>
    <item>
      <title>Change WordPress 404 redirect behaviour</title>
      <dc:creator>Dave Kellam</dc:creator>
      <pubDate>Tue, 16 May 2023 14:29:53 +0000</pubDate>
      <link>https://dev.to/plank/change-wordpress-404-redirect-behaviour-12h6</link>
      <guid>https://dev.to/plank/change-wordpress-404-redirect-behaviour-12h6</guid>
      <description>&lt;p&gt;When you visit a WordPress site url that doesn't exist, the default behaviour is to "guess" what you were trying to find. So, instead of landing on a 404 page, you'll possibly end up on a page that may or may not be what you were looking for. &lt;/p&gt;

&lt;p&gt;This behaviour makes sense if the permalink structure (routes) have changed, and the post is still named the same. However, it can be a jarring experience for a user to end up on an unrelated page that happens to contain one of the words in the slug.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two ways to modify the 404 behaviour
&lt;/h2&gt;

&lt;p&gt;Turn off 404 guessing altogether:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nf"&gt;add_filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'do_redirect_guess_404_permalink'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'__return_false'&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Use a strict redirect match (i.e. it will only redirect if it finds a post with the exact same slug):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nf"&gt;add_filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'strict_redirect_guess_404_permalink'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'__return_true'&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>wordpress</category>
    </item>
    <item>
      <title>WPCS: Use short array syntax</title>
      <dc:creator>Dave Kellam</dc:creator>
      <pubDate>Tue, 02 May 2023 15:14:28 +0000</pubDate>
      <link>https://dev.to/plank/wpcs-use-short-array-syntax-145h</link>
      <guid>https://dev.to/plank/wpcs-use-short-array-syntax-145h</guid>
      <description>&lt;p&gt;At Plank, we use the &lt;a href="https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/" rel="noopener noreferrer"&gt;WordPress Coding Standards&lt;/a&gt; in our development process. It helps ensure that everyone is writing code in a similar style, and that we follow best practices (like &lt;a href="https://developer.wordpress.org/apis/security/escaping/" rel="noopener noreferrer"&gt;escaping&lt;/a&gt; and &lt;a href="https://developer.wordpress.org/apis/security/sanitizing/" rel="noopener noreferrer"&gt;sanitizing&lt;/a&gt; data).&lt;/p&gt;

&lt;p&gt;That said, we don't necessarily agree with all of the rules. In particular, we prefer using the &lt;a href="https://make.wordpress.org/core/2019/07/12/php-coding-standards-changes/" rel="noopener noreferrer"&gt;short array syntax&lt;/a&gt; for php arrays. We find it easier to find when an array closes, rather than searching through a sea of closing parentheses (&lt;code&gt;);););&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;If you're using your own custom ruleset to extend the default standards, you do something like this to allow the short array syntax. If you &lt;em&gt;really&lt;/em&gt; don't like the long array syntax, you can disallow it, and &lt;code&gt;phpcbf&lt;/code&gt; should convert to short arrays with the second pattern.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- Allow short syntax arrays. --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;rule&lt;/span&gt; &lt;span class="na"&gt;ref=&lt;/span&gt;&lt;span class="s"&gt;"Generic.Arrays.DisallowLongArraySyntax"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- Disallow long array syntax --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;rule&lt;/span&gt; &lt;span class="na"&gt;ref=&lt;/span&gt;&lt;span class="s"&gt;"Generic.Arrays.DisallowShortArraySyntax.Found"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;exclude-pattern&amp;gt;&lt;/span&gt;*&lt;span class="nt"&gt;&amp;lt;/exclude-pattern&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/rule&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>wordpress</category>
      <category>phpcs</category>
    </item>
    <item>
      <title>Find all PDFs in a folder</title>
      <dc:creator>Dave Kellam</dc:creator>
      <pubDate>Tue, 28 Mar 2023 17:05:44 +0000</pubDate>
      <link>https://dev.to/plank/find-all-pdfs-in-a-folder-2nal</link>
      <guid>https://dev.to/plank/find-all-pdfs-in-a-folder-2nal</guid>
      <description>&lt;p&gt;A quick way to find all PDFs in a folder and dump the list into a text file on the desktop:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-type&lt;/span&gt; f &lt;span class="nt"&gt;-iname&lt;/span&gt; &lt;span class="s2"&gt;"*.pdf"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; ~/Desktop/pdf-list.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This should work to find any files of a specific type.&lt;/p&gt;

</description>
      <category>shell</category>
      <category>bash</category>
      <category>zsh</category>
    </item>
  </channel>
</rss>
