Day 15 – Share a WordPress tip or trick

Prompt 15/20

Blog: Share a WordPress tip or trick that has made your life easier. Post your response on a WordPress website and link it in the comments.

There are probably a couple for me, the first being ‘Plucks a certain field out of each object or array in an array.

$categories = get_the_terms( get_the_ID(), 'category' );
wp_list_pluck( $categories, 'term_id' );

Just feels like a really efficient way of just getting the info we need, in the above instance we just want and array of Category IDs that we could do something with. But this could be post IDs or child pages via query args.

Another is ‘Displays translated text that has been escaped for safe use in HTML output‘ This one is best if we might be using HTML in the string

<?php esc_html_e( 'Skip to main content', 'dogwonder' ); ?>

We could also use the following depending on the context in which the text is being used.

esc_html__( 'text to translate', 'text-domain' ) // To store a translated string in a variable, can be echoed later
__( 'text to translate', 'text-domain' ) // Needs echoing, no escaping
_e( 'text to translate', 'text-domain' ) // No escaping echos directly

In general it’s probably good practice to use either esc_html_e or esc_html__

It also has the benefit of preventing cross-site scripting (XSS) attacks.

Now you may never wish to translate your theme or plugin, but it’s not a bad idea to do the above if you ever think it might happen. It will save a huge amount of time later. You can then use a tool such as Poedit so scan your theme or plugin to create an empty translation file.

Day 14 – Take a screenshot of your IDE 

Prompt 14/20

Develop: Take a screenshot of your IDE open to a recent WordPress project (be sure to obscure any identifying details) and share it on your preferred social account. Post a link to your post in the comments.

This is a recent project where I am building a category filter. Bonus feature, I’ve just got access to GitHub CoPilot X so included that in the screenshot as well.

Screenshot of my IDE (Integrated development environment) showing a recent project where I am building a categories filter list

Day 13 – What is your favorite website built in WordPress right now

Prompt 13/20

Right now. whitehouse.gov

Built at speed, I think it was put together in 6 weeks (!!), when the new Biden administration came in. For me it was one of the first examples I had seen that demonstrated the potential power of the Gutenberg editor and block based development.

I’ve always been an admirer of the agency involved 10up. They presented their approach in a WordCamp in 2021. They presented it very well and it was an excellent overview of how they created the site, with bonus example code (abstracted as the whitehouse.gov code is not open source for obvious reasons).

Day 12 – ACF

Prompt 12/20

Blog: What is your favorite plugin in the WordPress Plugins Directory? Tell us about it on your WordPress website and link to it in the comments.

A.C.F

O.M.G.

We used to do all kinds of weird hacks with WordPress before ACF (Advanced Custom Fields) was released in 2012, using category archives as content hubs, tag clouds as navigation, hard-coded stuff everywhere…

Sure, there were meta box options out there and some custom database solutions, but nothing on the level of what Elliot Condon achieved with Advanced Custom Fields.

WordPress + ACF transformed what were essentially simple blogs into proper CMSs. It was released around the same time I started freelancing, which allowed me, as a fledgling business, to offer so much more as a WordPress developer.

For many years, I had been building what were essentially blogs with a few content pages for clients, but ACF opened up so many possibilities. Before that, you really needed to use something like Rails or Drupal to create ‘proper’ websites. Then came ACF.

In conjunction with custom post types and custom taxonomies, it supercharged WordPress and was incredibly easy to use. The documentation was amazing, and the support was incredible. The original pro licenses for repeater, flexible content, gallery, and options, priced at $25 (AUD), made even more things possible. It not only benefited me, but also empowered my clients to have more control over their own content without having to ask someone else to modify hard-coded values.

Since 2012, it has been the first plugin I install on every site, and I still do so to this day.

Day 11 – 2003

Prompt 11/20

WordPress was launched 20 years ago on May 27, 2003. Share a memory, a picture, or tell us a story about where were you in 2003. (If you weren’t born yet, tell us that too.) Post your response on a WordPress website and link it in the comments.

I was a ‘Web Development Executive’ at a London Publishing company in 2003, I maintained the corporate website at the time, mostly a mixture of ASP.net and HTML. Most likely using some gigantic CRT monitor and a Windows XP machine. I think I was using Dreamweaver maybe at this point, or maybe Frontpage 98?

I must have know a little about PHP as I apparently bought this in late 2001.

2024 2023 2022 2021 2020 2019 2017 2016 2014 2013 2012 2011 2010 2009 2008 2007 2006 2005 2004