Tag: PHP

A Code Snippet to Fix WooCommerce 3.0 Lightboxes

I truly love WooCommerce, but there’s one thing I don’t love about it: breaking changes. Working mostly in WordPress, breaking changes generally feel like something scary and challenging that I expect people in other environments to have to deal with—a bit like, say, cobras. The exception is WooCommerce, which brings the cobras right into my house.



Get a WordPress Image’s Attachment ID from its URL with a PHP Function from Pippin Williamson

pippin's plugins | retrieve image id from url
EDIT: As the comments below have pointed out, WordPress in later versions contains the attachment_url_to_postid() function, which is designed to do the job of the code below. However, on at least one project I’ve worked on (a WordPress multisite), WordPress’s function didn’t work and Pippin’s did. I’d try the WordPress function first and Pippin’s as a fallback.

You know who’s really great? Pippin Williamson.


WordPress Custom Taxonomies: How and Why to Create Them

Organizing your content is one of the core features of WordPress content-management system like WordPress. As such, WordPress creates what are called “taxonomies” to help you keep your content easy to find for both your and your visitors. Today we’re focused on why and how to make a WordPress custom taxonomy.



What WordPress Teaches Us About Software Ecosystems

WordPress is, without a doubt, one of the most successful pieces of software of all time. Sure, Microsoft’s Office and Windows are both more influential. Apple’s iOS is huge, as is Google’s Android. Linux is no chump either. But WordPress is relevant to all those platforms and more. And it has about the same name recognition to boot. If people can name a single piece of web infrastructure technology today, there’s a good chance of WordPress being the one they know. (Not counting Facebook as infrastructure.)


Adding and Using WordPress Custom Image Sizes: A Guide to the Best Thing Ever

wordpress custom image sizes lol
Update April 4, 2017: Added a section detailing how the responsive image system in WordPress 4.4+ works, and how WordPress custom image sizes interact with this system.

I really love being able to set custom image sizes in WordPress. The power and flexibility this system opens up for building beautiful, easy-to-administer, performant websites is hard to overstate.



Understanding Copies & References in PHP

The inner workings of PHP aren’t something most WordPress developers need to worry about too much. Especially if you focus on the front end and are a master of flex-box (I’m neither) you probably can safely never understand the subtleties of copies and passing-by-reference in PHP (or any other programming language). But as you make more complex plugins, this stuff starts to get kind of important. Important enough that you should read this great article by our friend Josh Pollock and get at least a little familiar with it.