Caleb Stauffer Style

Now Developing

Collection

Collection

Source: https://github.com/crstauf/collection.

A drop-in for WordPress sites and themes to make managing collections of data and entities easier. Accessing top-level collections in WordPress are easy, but subsets of those can be more difficult. Collection fixes that.

Collection is… well, pretty much anything: IDs, colors, keys, text snippets, images… anything in WordPress. I frequently needed to access a subset of posts, pages, products, events, etc., and creating a Collection keeps those subsets readily available. Think of it as a fancy array of data.

continue reading on my GitHub

Photo by Umberto Cofini on Unsplash

Image Tag

Image Tag

TL;DR: https://github.com/crstauf/Image_Tag.

Whenever you upload an image to WordPress, multiple sizes of that same image are created. WordPress natively generates versions of the image in the following sizes (can be adjusted in Settings > Media):

  • 150px x 150px (hard crop)
  • 300px x 300px
  • 768px x 768px
  • 1024px x 1024px

This is really cool, because it means when you insert an image into a blog post, the properly sized image for your visitor’s device will be displayed (since WordPress 4.4).

But for a custom theme or plugin developer, reproducing that behavior is a lot of work, especially on top of everything else to go with properly implementing an image.

And thus, I created Image Tag (a.k.a. Image_Tag), a helper class for generating img tags within WordPress.

(more…)