Official Blog

Enforcing WordPress Image Sizes Within Your Theme

WordPress Image Sizes

As a designer and programmer here at 10up, I have the unique opportunity to see my design through from the first wireframe to the fin

al product. There’s nothing that makes me grimace more than turning control over to a client only to see the design fall apart with use. Ensuring that as little as possible is “breakable” is on top of my quality assurance list. WordPress’s native, customizable image sizes is a common cause of breakdowns.

How I use image sizes in designs

Nothing disturbs my blank white canvas in Photoshop until I have set the grid and guides that will determine the structure of the layout. As I begin to flesh out the design, image placeholders find their way in, and they’re always made to fit within those guidelines. Common placeholders include a featured slider image, a thumbnail for the main index/search/archive post list view, and a special size for the “image” post format. Most of the time, I want images used within posts and pages to use these same consistent sizes so that the layout stays as clean as possible. Call me OCD, it wouldn’t be the first time. (Editor’s note: all great designers are a bit OCD!)

I could create predefined image sizes for each call to an image attachment (and I often do at least one or two of those), but defining an endless set of sizes has a real performance toll every time an image is uploaded, not to mention the bloating effect on the upload directory. If I define 5 custom sizes, and we add that to the 3 default sizes (thumbnail, medium, and large), we wind up with 9 sizes, counting the original. That’s 9 images generated every time an image is uploaded to the site. I always try to avoid the weight and clutter by using the default image sizes.

Enforcing the image sizes

It may have crossed your mind that this breaks my own OCD rule, as administrators can adjust default image sizes from the Media settings page. But wait – that’s what this post is all about! Let’s get to some code.

Techonomy ’12 – Social *is* the message

On November 11 to 13, I was privileged to attend Techonomy ’12 in Tucson, Arizona, with 10up founder Jake Goldman. Techonomy ’12 in Tuscon featured exciting content and internationally-known business, science, and political leaders focused on the intersection of technology and the global economy. Sponsored by companies like Forbes Magazine, speakers included technology, finance, education, and publishing luminaries like Steve Forbes, EMC CEO Joe Tucci, AI pioneer and author Ray Kurzweiler, and Nielsen president Steve Hasker.

Techonomy founder David Kirkpatrick led and moderated the 3 days of talk about the accelerating speed of technological progress, driven by increasing availability of the Internet and mobile devices. And that change is not limited to just technological progress, but to human progress as well: the technology-empowered individual is affecting a major shift in economic and political power on a global scale.

WordCamp Toronto: Developers

This is a post about a WordCamp. It is far from the first one: we sponsor and send people to a number of them each year . This past weekend I had the opportunity to speak at WordCamp Toronto: Developers.

Toronto has now held the second developer-centric WordCamp. The idea—as it was explained during the opening remarks—is that these are viability tests of niche WordCamps.

The Toronto organizers are (rightly) considering the test a success. They sold out tickets with an attendance near 300 and a slate of talented speakers despite Hurricane Sandy forcing a last-minute call for speakers.

I had the opportunity to speak about how to create websites tailored to the people using them through a process called Interaction Design. This half science, half design discipline answers questions such as:

  • Who is the site being created for, what do we mean by “user?”
  • What tasks and goals should this website address?
  • How will someone interact with the website?

WordPress Community Summit

This past week, Jake, Helen, and I were privileged to attend the inaugural WordPress Community Summit in Tybee Island, GA.  The Summit was a unique opportunity for many of the top contributors in the WP community to get together, share ideas, and – for many of us – meet in person for the first time.  You can cover much more ground in a 45-minute roundtable discussion than you can in an off-and-on discussion on Twitter.

The core of the event was a one-day “conference of conversations” – we broke out into 35 separate unconference sessions, each of which lasted just under an hour and covered a variety of topics. Read More on WordPress Community Summit

WordCamp Providence: Birth Place of 10up

This weekend 10up is sponsoring the first ever WordCamp Providence as a top-level Anchor Sponsor!

This is a special camp for us, since 10up started in Rhode Island. Jake also started the WordPress Providence Meetup group, which Luke now leads, that became the foundation and organizing team for this WordCamp.

Jess Jurick, one of our Senior Web Strategists, will be speaking on Writing Tools for WordPress, reviewing offline and online tools to help you brainstorm topics for your blog, produce great content for your audience, and distribute that content to your online communities. Much to his disappointment, Jake can’t make the camp due to a personal conflict in his schedule, but he promises to be with us in spirit!

WordPress Plug-in Self Deactivation

WordPress 3.5 is almost upon us, and I was excited to learn that my Sort Query by Post In plug-in had been folded into core, thanks to a ticket I opened and submitted a patch for some time ago. Sort Query by Post In allowed developers to return posts from a post query (WP_Query) in the order designated using the post__in parameter.

Now that identical functionality is in core, I wanted to update my plug-in to automatically disable itself – with a notice – for users running 3.5 or newer. This code would also prevent the plug-in from being activated if installed on 3.5 or newer. Surprisingly, there seemed to be a dearth of good tutorials, so I came up with my own solution.

Webfonts, CORS, and IE

We do quite a bit of development on the WordPress.com VIP infrastructure, where sites are generally domain-mapped and theme files are loaded over their CDN. Recently we developed a site where the webfont needed was not available through a hosted service, so @font-face was used to include the font files. Once the site was off of our local and staging environments and moved onto WordPress.com, however, we discovered a number of issues concerning the fonts.

jQuery Developer Summit 2012

This week, I had the privilege of attending the first ever jQuery Developer Summit. I spent two full days hacking jQuery and collaborating with the jQuery team and community to squash as many bugs as possible. The Summit was held at the AOL campus in Dulles, VA.

I was assigned to Table 2 where our goal was to fix jQuery bugs. We covered a vast array of topics including Grunt.js, Git and TestSwarm. It was refreshing to see so many JavaScript engineers get together to talk about complex JavaScript bugs and solutions.

Yesterday, we kicked off the Summit with several brief presentations from various jQuery team members and discussed the goals for each table. After this, we jumped into code head first. Dave Methvin, president of the jQuery foundation, was at Table 2 leading the bug assignments and assisting us whenever possible. The bug I was assigned to fix (#12519) branched into many other conversations that made us question the design principles of the correlated code that the bug referenced. After rationalizing the best way to address these issues with Dave and several jQuery members, we finally decided on a solution. I committed the changes Tuesday morning and my pull request was approved shortly thereafter, representing my very first jQuery core patch on behalf of 10up!

I’m looking forward to continuing to contribute to the jQuery community and to exploring new ways to integrate advanced jQuery solutions into WordPress.

Taylor, Zack, and Jeremy at WordCamp Vancouver

WordCamp Vancouver is coming up quick and 10up is excited not only to be a bronze level sponsor, but to also represent with three developers from our Portland contingent.

Zack Tollman, Taylor Dewey, and myself have all had the pleasure of participating in the entire WordCamp Cascadia circuit for 2012 and can’t wait to see the friends we’ve made and those we will make this weekend. The Pacific Northwest has a unique and wonderful WordPress community and we’re happy to be a part of it.

I’ll be starting the developer track off on Saturday with a talk on ‘Calm and Simple Code’. We’ll have a good time going through the reasons and best practices for remaining simple and coding with purpose when working with WordPress as a framework.

Later in the afternoon, Zack will be tackling the topic of cache invalidation in WordPress. It’s often easy to get started with the WordPress transient API and object caching in general, but things can quickly turn difficult when you start looking for the best approach to invalidating your caches to keep your data fresh.

And to top it off, we’ll be there for the first ever BuddyCamp the following day!

Be sure to look for us in our 10up shirts on Saturday, though we may change for your benefit on Sunday. Any topic is welcome. We can help you with your WordPress questions, converse about some geeky technical issue, or give you an overview of 10up and what kind of work we do on a daily basis. We’re always interested and we’re always hiring!