Thinking » Topics » Open Source
The talk that really stood out for me was Dependency Management in PHP: Better Late Than Never. The speaker, Sequoia McDowell (@_sequoia), highlighted the reasons for and benefits of using Composer.
WordPress is a key tool for making great things happen here at Oomph, and it’s just become even better. The August 1st release of WordPress 3.6, nicknamed Oscar, continues to expand the potential of web development and comes with a huge list of new possibilities to enhance your website.
Not only are we eager to officially start using WordPress 3.6, we are honored to announce our Site Operations Team Lead, Jim Reevior, had a role in its development! WordPress prides itself on being a collaborative effort – a content management system created by it’s own users. Back in March, Oomph sponsored the first Boston WordPress Hack Day, giving developers a chance to contribute to WordPress core and 3.6. Along with Jim, a team of Oomph developers attended the event and spent the day giving back to one of our favorite platforms.
Keeping up with new technologies is sometimes daunting, even for those who work in technology day in and day out. Fortunately, conferences and camps like Design4Drupal are ideal resources for new information, inspiration and networking. This past weekend in Boston, Nick Blanchard, Alex Vallejo, and I had the opportunity to attend D4D at the Stata Center on the MIT campus. This two-day camp offered sessions geared toward developers and designers—and even a few geared toward business owners and project managers.
Investigate. Collaborate. Solve. It’s what we do here at Oomph, and every so often we like to share how we do it. This is a short story about finding WordPress shortcodes using regular expressions.
A few weeks ago, I was tasked with converting a good amount of embedded video from one host platform to another for one of our clients. I wrote two Command Line Interface scripts in the process: one to identify and categorize the 1,200 instances of video code, and another to make the conversions. I did it using regular expressions. Here’s the why and how:
While you could use the WordPress function get_shortcode_regex(), this action will return an array of all the regular expressions in your post content. That means you would still need to conditionally check for your target shortcode within that array and, if found, determine the appropriate array index and operate on that match.
A quicker route to extract a specific shortcode in post content would be to directly use a regular expression:
$your_shortcodes = preg_match_all( '#\[your-shortcode-here\s*.*?\]#s', $content, $matches );
This will find all instances of your self-closing shortcode and return an array of them. Just one line of code will save you time, and you can loop through your posts and make the necessary changes.
As for our shortcode story, the conversion script ran seamlessly—and all the videos lived happily ever after on their new host platform.
The WordPress Zone Manager plugin—alias The Zoninator—helps site admins curate content by allowing them to create content “zones” anywhere on their website. Content is then assigned to designated zones and ordered based on criteria configured on the backend. Oomph’s Vu Huynh has been working to optimize the power of Zone Manager for our clients, and we sat down with him to talk about what’s possible with The Zoninator.
What are some of the key benefits of the Zone Manager plugin?
Zone Manager provides an easy-to-use administrator interface to queue posts in any order without any programming knowledge. This is particularly useful when a certain post order cannot be easily made through a query. Zones can be quickly added, edited and deleted through the admin interface.
How have you been using Zone Manager?
I’ve been using Zone Manager as a means to “feature” posts on a homepage and a homepage-placed sidebar. Administrators can have a specific post remain on the homepage even if the post would normally be archived because of its publish date. Zones are sometimes used as an alternative to stickies when you want to have a featured post remain on the homepage despite its place in the chronological order.
What else is possible with Zone Manager?
Any content type can be placed into zones, not just posts and pages. So anything that queues content into a list can use Zoninator as an interface to do so, such as a custom gallery.
The first annual WordCamp Providence was held on October 27th. The sold out event brought 200 WordPress developers, designers and the WordPress curious out to the University of Rhode Island campus.
Being a developer, my main focus for WordCamp was the Shipbuilding track. Jon Bishop started off the talks with best practices for providing clients with an admin that will fit their needs and not add unnecessary complexity. Aaron Holbrook followed up by showing how using version control — specifically git — will aid in code maintenance and rapid deployment.
The morning session concluded with Automattic’s John James Jacoby discussing how to secure your code from potentially malicious data, methods of testing your code and the advantage of using xdebug to step through not just your code, but WordPress core as well. John’s IDE of choice is Netbeans, which works very well with xdebug. I tried Netbeans a couple years ago, but switched away. After John’s talk, seeing how easy it is to step through code and access the code to core functions, I’ve switched back. The latest version is a vast improvement in performance and functionality; I strongly suggest giving it a try. Unfortunately, John didn’t provide links, if that changes, I’ll post an update.
Oomph’s own Ben Doherty started the mid-day portion of the developer track with a talk on implementing object oriented programming into theme development. Ben explained how using OOP principals in theme development will result in code modules that can be easily reused in other themes, providing consistency in development. He touched on how to set up a development environment for debugging, different implementations of a singleton, and using actions and filters for accessing class methods. You can read through his presentation at http://bendoh.github.com/WordCamp/wcpvd-2012-oop/
Jon Desiosiers broke down the fundamentals of plugin development, including best practices and what to do when you get stuck. Matthew Boynes built upon Aaron Holbrook’s talk by demonstrating how to use git and a WordPress multisite implementation to develop and deploy code between a local development environment and a hosted staging or production server. You can watch his entire presentation at http://boyn.es/2012/10/28/wordcamp-providence-2012-presentation/
In the home stretch of the Shipbuilding track, K. Adam White talked about Backbone.js and Underscore.js, two new libraries that will be available in WordPress 3.5. These libraries can provide structure to jQuery code via a modified implementation of MVC (Model, View, Collection). The track was concluded by Oomph developer turned Automattician Erick Hitter’s reprising of his WordCamp Boston talk on going beyond the codex and learning more about WordPress by looking at the core files. Erick breaks down the structure of core and where to start looking for the function or filter that will best suit your needs.
Providence’s first WordCamp was a great success, with fantastic speakers and a good vibe all around. I congratulate the organizers for a well planned event and I look forward to next year.