A Seacoast NH WordPress Developers Meetup took place on June 3, 2014 and, due to a last minute schedule change, we had no presentation. This gave us the opportunity to switch to an open forum, because there’s nothing easier for us than to talk about WordPress development for 2 hours. Thanks to Alpha Loft on Green Street in Portsmouth, NH for providing our venue.
Custom Templates for Custom Post Types
We started off talking about an issue David Long was having with creating custom templates for custom post types. David found himself generating a bunch of templates to query a custom post type for different meta values on a meta key. David wanted to re-use WordPress Loop code and not repeat the code in the templates (DRY). One solution (of a few) was to pass in the desired query meta value in the page URL and use the HTML/PHP $_GET[ ‘value_name’] variable . Code was then written to grab the value of this variable (with error checking) and pass it to the Loop query. Now David could write one template to handle all the queries.