Seacoast NH WordPress Dev Meetup – An Open Forum

wordpress-developmentA 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.

This led to a discussion about custom RSS feeds for custom post types.  Amanda Giles showed us how to pull some standard WordPress RSS feed code, modify it for a custom post types, and include that in the client’s theme.  Tangentially we learned that RSS feeds are used by services like MailChimp to pull data from a WordPress website to use as content for email newsletters.

Customizing Themes

Next topic was an issue I have with WordPress Theme files being passed around in different text editing or FTP environments.  Basically the carriage return / line feed at the end of text lines gets stripped or doubled up.  This happens when moving between Windows/Linux, PC/MAC, and over some FTP connections.  No one had a real solution, but we all shared horror stories, which in itself is satisfying, knowing others have the same problem, and being aware of the pitfalls.  This isn’t an issue 99% of the time, when files remain in a consistent development environment.

Modifying CSS on purchased Theme was discussed.  Often clients like a packaged theme but want to make slight changes to the look.  I was helping another developer, Meg Marshall, achieve this goal.  First attempt was to directly edit the CSS (style.css) of the theme.  It worked, but it’s a bad idea because the changes will be overwritten when the theme is updated.  Additionally, I work in PC text editor, Meg is on a Mac, and the file was bounced around on FTP, which resulted in an unreadable (by humans) CSS file.  My second solution was to create a custom plugin to include the unique CSS styling using the WordPresss function wp_enqueue_style().  This will work in the long run, unless the theme changes the CSS id names in a future update.

Another solution suggested was to use the custom CSS editor included in the WordPress plugin Jetpack written by Automattic.  My general distaste of using external plugins was aired, again (ha!), and others pointed out that Jetpack, though powerful, has a reputation of slowing down a website.  It also had a recent security flaw, fixed with an update.  Ergo, avoid using 3rd party plugins when possible.

Required Reading

the-year-without-pantsThis led perfectly to my recommendation of a book that should be read by all WordPress developers, ‘The Year Without Pants: WordPress.com and the Future of Work‘ by Scott Berkun.  The book, mainly about virtual work styles and managing remotely, is also an inner view into the history and development of WordPress.  The author led the team which developed Jetpack, know internally as a bridge between WordPress.com and WordPress.org.  Highly recommended reading for WordPress geeks.

Hacked Sites

Our final discussion was about hacked websites, how it happens, how to fix them.  In many cases, we’re finding WordPress is not at fault.  Often server hosts are hacked and sites are infected this way.  David Bucciero pointed out that applications are the weak point and every website on a shared server is vulnerable.  Hackers don’t want to bring down your site but use your server resources for email spamming, pharmaceutical links, etc.  Seeing hacked sites is so common now that it’s kind of like talking about bad weather.  We all have to endure it, and it’s out of our hands.  Keep a backup of your site.  Be ready to move it to another server host.

Seacoast NH WordPress DevelopersNext month’s Seacoast NH WordPress Developers Meetup will be about using a PHP debugger in a WordPress environment, when echo statements or print_r() aren’t enough to find the coding problem.