Earlier this month, I helped relaunch Pottery Barn’s blog. The homepage and each brand page (PBteen example) are moderately configurable through the WordPress Customizer. Building this functionality was an opportunity to make user-friendly decisions about the management experience.

Smarter Featured Gallery

2015-12-30 at 9.27 AM

By default, the topmost UI element on each homepage will display the most recent published post. In the Customizer, the Pottery Barn team can choose one or more posts for promotion with an AJAX post selection tool (plugin in-progress). If multiple posts are selected, then the UI element turns into a carousel (powered by Slick).

Look ma, no checkboxes!

Magical Pin Promotion

2015-12-30 at 9.39 AM

Further down the homepage, the Pottery Barn team wanted to promote their top Pins from Pinterest. Rather than create a more complicated workflow of uploading images and completing multiple fields per Pin, I decided to magically pull in Pin metadata from their Open Graph / Twitter Card tags.

Drop a link in — voila!

If you’re considering a similar approach, here are a few technical details I worked out:

  • Rather than make a number of on-going frontend HTTP requests, I decided to fetch the metadata when the links are saved, and store it in options.
  • Pinterest will block your IP address if it thinks you’re a bot. If your code mysteriously stops working, you might want to check the response.
  • Pinterest’s Twitter Card image source is better to work with than Facebook Open Graph because Pinterest forcefully crops the Open Graph image to a Facebook-friendly proportion. The Twitter Card image source appears to be the original proportion.
Hand Built is Daniel Bachhuber, an effective developer with technology leadership you can trust.

How can I help?

Hit me at [email protected] with a short note about what you'd like to do.

My roots are WordPress and publishing, and I love pretty much everything related to web development (architecture, performance, security, etc.). When not working with clients, I also maintain WP-CLI (WordPress' command line interface) and other open source projects.

Want to connect? I'm on Twitter, Github and LinkedIn. Or, sign up for my TinyLetter for periodic newsletters.