Steve Grunwell

Open-source contributor, speaker, and electronics tinkerer

Category: Code

How did I not know about get_post_types_by_support()?

Every once in a while (well, more often then I’d care to admit, actually), WordPress core surprises me with a function that I had no idea existed. They often come in the form of utility functions, things written when developers decide “oh no, I have to write this piece of logic again?!”. Heck, there have even been talks on these hidden little bits of code that make the world a brighter place.

Today, that function is get_post_types_by_support().

Continue reading→

Generating a new Reveal.js presentation using a Yeoman generator

Building Presentations with Reveal.js

As I mentioned in my Exporting Reveal.js Slides to PDF Using Decktape post last week, I tend to use Reveal.js – a HTML- and JavaScript-powered presentation framework – for most of my conference talks. Having given a fair number of presentations using the framework over the last few years, I thought it might be useful for speakers who haven’t yet tried (or found their footing with) Reveal.js if I laid out my preparation workflow.

Continue reading→

Cranes constructing a new building

WordPress Plugins: Procedural or OOP?

As you may be aware, I have a profile on PHP Mentoring and am currently working with a number of PHP developers looking to grow their skills and kick-start their careers. Last week, I received an interesting question through the site, and half-way into writing my response I realized it would make a useful blog post: when writing a WordPress plugin, should I be using procedural or object-oriented programming?

Continue reading→

Close-up of a Rivera guitar amplifier

Getting started with AMP for WordPress

Late last year, Google and other organizations rolled out the open-source Accelerated Mobile Pages (AMP) Project, with the goal of introducing lightweight, lightning-fast content for users on mobile devices. AMP is essentially a subset of HTML and scripts – optimized for caching and performance – designed to speed up the mobile web and to make content accessible to every user, regardless of connection speed or strength.

A few months ago, 10up President Jake Goldman published What Google’s Accelerated Mobile Pages (AMP) means for Consumers, Publishers, and the Future, a piece that has helped spark a lot of interest in Accelerated Mobile Pages among 10up’s clientele, a group lined with major publishers and news outlets. In the article, Goldman concludes that publishers “in a crowded or hotly contested news space, or seeing meaningful traffic to stories from Google, need to quickly prioritize AMP HTML.”

Continue reading→

Enhance your Editorial Experience with Advanced Post Excerpt

I recently released Advanced Post Excerpt, a free plugin that replaces the standard WordPress “Post Excerpt” meta box (a plain textarea) with a stripped down TinyMCE editor instance. Finally, there’s no need for your authors to write HTML (or copy it out of the “Text” tab of the main editor); instead, they’re given the essentials for WYSIWYG text editing (bold, italic, link, etc.) and nothing more.

Continue reading→

Announcing WP404

I’ve been behind on announcing new projects, but I wanted to make sure I shared this one:WP404 is a framework for capturing additional information and details about WordPress 404 errors, packaged as a WordPress plugin.

The plugin was born out of a need to capture tricky, time-based 404s on a client site. I figured I could either throw something together quickly on the client’s dime or spend my lunchtime and evening building something the community could use. Guess who didn’t want a half-assed tool? ?

Continue reading→

Announcing WP Enforcer

Anyone who’s had to do code reviews on a team before can tell you that inconsistent coding standards add a lot of unnecessary noise to the review process. Even minor things like trailing whitespace, spaces v. tabs, code indentation, and whitespace (or lack thereof) around function declarations can cause merge conflicts and increase the time it takes to do a good code review.

Fortunately, coding standards are pretty easy to check, and there are great tools like PHP_CodeSniffer that can scan your codebase for issues with coding standards. WordPress has a well-defined set of coding standards, and there’s even a collection of PHP_CodeSniffer standards for WordPress. With Composer and a little bit of configuration we can check our coding standards, catch common security issues (missing input sanitization, output escaping, etc.), and even validate that everything’s well-documented.

We have the tools to write standards-compliant code, so now we just have to configure them and make them run automatically. That’s where my latest project comes in: I’m happy to announce WP Enforcer is available for your projects!

Continue reading→

Announcing Revision Strike

I’m proud to announce my latest WordPress plugin: Revision Strike.

Unless post revisions are explicitly limited, WordPress will build up a hefty sum of revisions over time. While it’s great to have revision history for some recent content, the chances that old revisions will be necessary diminish the longer a post has been published. Revision Strike is designed to automatically remove these unneeded revisions on older, published posts.

Continue reading→

Sunsetting WP Password Generator

My WP Password Generator plugin was my first foray into WordPress plugin development. It started back in 2010, just over a month after I started at Fahlgren Mortine, when my friend Greg Laycock and I were working on a client’s WordPress site and decided that manually generating passwords was a total pain. I suggested “what if we have a ‘Generate Password’ button on the user edit screen?”, he agreed, and I spent that night writing a quick plugin that makes an Ajax call to a script that generated a password. After we submitted it to the WordPress.org repository, we watched the download counts climb (I remember how thrilled we were once we crossed 100, and it just continued to rise from there).

As time went on, feature requests rolled in through the plugin forums and GitHub, but we intentionally kept the features simple (it’s a password generator, not a whole user management suite, after all). It was eventually rewritten to better adhere to the WordPress coding standards and use the native WordPress wp_generate_password() function instead of my home-rolled solution (which was actually pretty similar). It was never the flashiest plugin, but it was a perfect learning experience for both WordPress plugin development and managing an open-source project.

Continue reading→

Quick Tip: Google Publisher Console

My Engineering Manager, Ivan Lopez, turned me on to the Google Publisher Console last week, which gives you a nice way to debug Google DFP ad placements.

It’s simple to use, simply ad ?google_force_console to a URL that’s using DFP and Google will automatically load a nice inspector to see what data is being used to generate the ads on a site.

Continue reading→

Page 4 of 7

Be excellent to each other.