20 May 2012
WordPress Planet
Weblog Tools Collection: Code Poet v2: More than Just a Directory
Code Poet has just relaunched, and it is now so much more than the directory of WordPress professionals that it was before. If you build anything with WordPress, Code Poet is now on the fast track to be your one stop shop for resources and information.
Today, Code Poet features free eBooks from WordPress professionals, interviews with WordPress professionals, useful resources from the WordPress community, and a handy quiz to test your WordPress knowledge. As you can imagine, Code Poet is gearing up to be a massive resource build by WordPress professionals for WordPress professionals and aspiring power users.
If you're still looking to hire someone, the Code Poet Directory still exists, and aspiring Code Poets can still apply to be part of the prestigious directory.
Head over to the new Code Poet, grab a free eBook for the road, and take the quiz right away. How did you do on the quiz, and what do you think of the newly relaunched Code Poet?
20 May 2012 2:00pm GMT
19 May 2012
WordPress Planet
WordPress.tv: Seth Carstens: Smartphones and Tablets and Bears, OH MY!
Dev Blog: Plugin Directory Refreshed
Been hanging out with a few WordPress.org hackers - Scott, Nacin, and Otto - the last few days in a BBQ-fueled haze of hacking to make plugin directory better. There are over 19,000 plugins listed and they're really the heart and soul of WordPress for many people, so they deserve a little tender loving care. Here's a quick before and after snapshot you can zoom in on to see a visual overview of some of the changes:
Our first focus was around improving the discussion and support around plugins.
You'll now notice that threads about a plugin are pulled directly into a "support" tab on the plugin page - each plugin has its own forum. We've made authors much more prominent and with bigger Gravatars and better placement, so you can get a sense of who made the plugin you're using. And finally to show how active and well-supported a plugin is, you can see "16 of 75 support threads in the last two weeks have been resolved." Finally, if you're logged in you get access to the new "favorites" feature that lets you mark the plugins you use the most so you can share them on your profile page and find them quickly later. We soft-launched favorites a few days ago and there have already been 2,000 saved!
If you're a plugin author, we've started with a short threshold (2 weeks) for the resolved stats so it's easy to catch up and stay on top of it. (It'll eventually go to two months.) You also now have the ability to set stickies on your plugin forum to put FAQs or important information at the top, and of course any person you put as a committer on the plugin will have moderation access. People on the forum tag will see your custom header and links to the other resources attached to your plugin.
We've tightened up the styling a bit on the forums and plugin pages, though still some cleanups to do there. Some older improvements you might have missed, but are still useful for users and developers alike:
- "Plugin headers" or those cool graphics you see at the top of plugin pages have really taken off, there are over 1,600 active now.
- You can now subscribe to get an email whenever a commit is made to a plugin repository even if it isn't yours. There is no better way to follow the development of your favorite plugins. There's nothing like the smell of fresh changesets in the morning.
- Behind the scenes, we've dramatically ramped up proactive scanning of the entire repository to help authors fix security and other problems they might not even know about yet. The quality level of the repo has gone way, way up.
All of this will continue to evolve as we get feedback and see usage, but we're happy to have been able to make some key improvements in just a few days while hanging out in Memphis. (This is why WordCamps usually have BBQ - it imparts magical coding powers.)
19 May 2012 6:56pm GMT
Weblog Tools Collection: WordPress Theme Releases for 5/19

Art Blogazine is a simple and minimalist theme with HTML5 markup.

Outline is a beautiful, simple, elegant, monochrome theme for blogs or websites with a simple floral motif in the header.

Phire is a modern and easily customizable dark theme.

WPstart is a simple parent theme allowing you to create any type of website you want.
19 May 2012 2:30pm GMT
18 May 2012
WordPress Planet
Matt: WP BBQ in Memphis
For the third year now I'm over in Memphis for the World Championship of BBQ, joined by Otto, Nacin, Scott, and Rose. Last year due to flooding the festival was moved to a fairgrounds inland, but there's nothing quite like being right on the Mississippi with the sweet aroma of pork all around you. (An aroma that, incidentally, follows you home in your clothes.
) The team we sponsor, the Moody Ques, put together an impressive booth this year, which you can see coming up in the below timelapse:
The video doesn't do justice to the delicious food being cooked inside, though, which you have to experience in person.
18 May 2012 4:30pm GMT
Matt: Building Have Baby / Need Stuff
Mark Jaquith writes How I built "Have Baby. Need Stuff!" - a nice overview of the latest and greatest in modern WP development.
18 May 2012 4:08pm GMT
17 May 2012
WordPress Planet
Alex King: Social 2.5 beta 2
We're just about ready to put a bow on version 2.5 of Social. If you'd like to test the second beta release, grab it from GitHub.
Social is a plugin that allows you to maintain a centralized conversation on your site, while also participating in conversations on Facebook and Twitter.
17 May 2012 9:44pm GMT
Weblog Tools Collection: WordPress Plugin Releases for 5/17
New plugins
Monster Widget provides a quick and easy method of adding all core widgets to a sidebar for testing purposes.
Updated plugins
Bad Behavior complements other link spam solutions by acting as a gatekeeper, preventing spammers from ever delivering their junk, and in many cases, from ever reading your site in the first place.
Yepty is yet another pay per click advertising plugin.
17 May 2012 2:00pm GMT
16 May 2012
WordPress Planet
Weblog Tools Collection: WordPress Community Summit
The WordPress core team is pulling out all the stops this year and shooting for a big summit to be attended by prominent contributors and community members.
Instead of the traditional meet up, which is typically attended by only the core developers and their chosen guests, the core team is now looking for your nominations to decide who will attend the first ever WordPress Community Summit. The Summit will allow the core developers to get to work with the best and brightest of the WordPress community (support forum volunteers, the Theme Review Team, volunteer documentation editors, community organizers, theme shops, etc.), and who knows what amazing things they'll come up with when they put their heads together!
If you have any favorite community members or companies, even that lone support forum volunteer who rescued your blog, make sure that you leave a nomination for them right away. Sure, you can nominate yourself too, but do be a good sport and nominate at least one other person or company.
16 May 2012 2:00pm GMT
WPTavern: Searching Only The Codex
When performing a search on the Codex, you're presented with a slew of search results. However, not all of those results are within the Codex. The search portion of the Codex is powered by a Google custom search box which not only presents results from within the Codex, but from across WordPress.org as well, mainly the support forum.
While performing a search for Conditional Statements, the first result was the one I was looking for. However, if you want the results to strictly be within the Codex, I came across this link shared by Otto on the Documentation mailing list. While giving this method of searching the Codex a try, I found it difficult to find the Conditional Statements page I was looking for that was easily displayed by the Google Custom Search box. Even by checking each box, I failed at finding the page using both Conditional Statements and Conditional as my search terms.
My advice, stick to using the Search box that exists on the Codex page.
No related posts.
16 May 2012 1:00pm GMT
Donncha: Fatal error: Allowed memory size of 67108864 bytes exhausted
WordPress uses memory. Plugins and themes use memory. New versions of software may use more memory than before. When that happens and PHP on your server doesn't have enough memory then PHP will stop with a fatal error like this:
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 1203208 bytes) in /home/*****/public_html/wp-admin/includes/class-pclzip.php on line 4215
This happens quite a bit but it's not a bug in WordPress or your new plugin or theme, you simply need to let PHP use more memory on your server. Thankfully WordPress makes it easy to do this. You must define a constant, WP_MEMORY_LIMIT in your server's wp-config.php like this:
define('WP_MEMORY_LIMIT', '128M');
The error message will give you an idea of how much memory is required. The error message says it tried to allocate 1203208 bytes or just over 1MB of memory. The limit here is 67108864 bytes, or 65536KB which is 64MB so here I'd need a WP_MEMORY_LIMIT of more than 66M. The error message will go away once PHP has enough memory but be sure to test it.
If you allocate too much memory your server could start eating into disk swap space. Also be aware that each Apache child process is allowed to use that much memory so if you had ten processes it could use ten times the memory limit in a worst case scenario. If that happens you'll need more RAM or you'll have to figure out what's using so much memory.
There's also a WP_MAX_MEMORY_LIMIT constant. By default it's 256M and it's currently only used when uploading images.
On the off chance that you don't have WordPress installed and you came here from a search engine, then you'll want to use ini_set() somewhere early in the PHP process to increase the memory limit:
ini_set('memory_limit', '128M');
Finally, I love that the wp-config.php codex page is the first result of a search for WP_MEMORY_LIMIT.
Related Posts
16 May 2012 12:50pm GMT
15 May 2012
WordPress Planet
Dev Blog: Calling All Contributors: Community Summit 2012
Each year, the WordPress core development team meets in person for a week to work together and discuss the vision for WordPress in the coming year. As annual events go, it's easily my favorite. Don't get me wrong, I love attending WordCamps and local WordPress meetups (which are awesome and you should try to attend if you are able), but at the core team meetup, the focus on working together and getting things done is unique, as is the experience of every person in the room being so highly qualified. This year, instead of just planning a core team meetup, I'm aiming a little higher and shooting for a full-on contributor/community summit.
Core code isn't the only way to contribute to the WordPress project. We have an active theme review team, support forum volunteers, people writing documentation, plugin managers, community event organizers, translators, and more. The teams have been siloed for too long, so we've recently begun the process of bringing them together by having teams elect representatives to facilitate more communication between the contributor groups. These reps will form the nucleus of the contributor summit now being planned for a long weekend at the end of October in Tybee Island, GA. This is completely different from a WordCamp. It will be a combination of co-working, unconference, and discussions among the project leaders, and participation will be by invitation.
In addition to bringing together the active contributor team reps to work together, I think it's important to include community members who don't fall into that category (at least not yet!). Successful WordPress-based business, authors of popular plugins and themes, and people using WordPress in unexpected but intriguing ways should have a place at the table, too. That said, part of the magic of the core team meetup is the small size; it allows every voice not only to be heard, but to engage. Since this is my first attempt at bringing together so many groups and points of view, I want to try and keep it small enough to retain that personal atmosphere while at the same time ensuring that the best possible mix of people and businesses in the WordPress ecosystem is represented. This is where you come in!
Taking a cue from events with limited availability like AdaCamp (attendance) and the jQuery conference (speaker roster), I want you to nominate people and/or WordPress-based businesses to participate in the summit. Yes, you can nominate yourself.* You can nominate up to 10 additional people - be prepared to provide URLs and the reason you think they should participate. You can also nominate up to 10 WordPress-based businesses without naming individual people, so if there's a theme or hosting company (for example) that you think should be there, you don't need to go looking for employee names. This nomination process will hopefully ensure that we don't overlook someone who is making a difference in our community when it comes time to issue invitations.
Nominations will be open for a week, after which the survey will be closed and the process of analyzing the results** will begin. The nominations process will lead to invitations in June, confirmations in July, planning in August and September, and the summit itself in October. Hopefully we can stream and/or record some of the activity to share online at WordPress.tv. Additional invitations may be extended up until the event if there are people/businesses that become more active in the community. If you're thinking to yourself that maybe now's the perfect time to start contributing time to the WordPress project, good thinking! In the meantime, if you want to weigh in, fill in the community summit nomination form. Thanks, and wish us luck!
* Nominating yourself: Do nominate yourself if you fall into one of the categories described in the post above, or if you believe that you have a unique point of view. Please do not nominate yourself if you just think it would be cool to hang out with this group. This is a working event, and everyone is expected to bring something special to the table.
** I (and/or a helpful community volunteer) will sift through the nominations and compile a shortlist of the most-nominated people/businesses and the most intriguing underdogs. This list will be reviewed by the summit planning committee (made up of team reps) to create the invitation list.
15 May 2012 10:36pm GMT
Alex King: WP App Store

Congratulations to Brad on today's launch of WP App Store. I'm very pleased to see this come to life. It's an idea we toyed around with several years ago, but decided not to pull the trigger on - I hope it's a huge success.

We've put our FavePersonal and FaveBusiness themes along with our RAMP plugin into the app store. If you'd like to check it out, download the plugin and start browsing. There is a great group of companies represented already and I'm sure we'll see more additions as the project grows.
15 May 2012 9:18pm GMT
Mark Jaquith: How I built “Have Baby. Need Stuff!”
Have Baby. Need Stuff! is a baby gear site that my wife and I just launched. I thought I'd share how I built it.
WordPress Core
WordPress is a Git submodule, with the content directory moved to the /content/ directory. This makes my Git repo smaller, as WordPress isn't actually in it.
Underscores
For a theme base, I started with the Underscores starter theme by the theme team at Automattic. Underscores is not a theme itself… it's a starting point for building your own theme.
Bootstrap
Next, I integrated Bootstrap, by Twitter, to handle the CSS base and the grid system. Bootstrap is a really powerful framework, and version 2.0 has great responsive design support, which allowed me to create a single design that scales up to big screens or down to tablet or phone screen sizes. Try resizing it in your browser to see the responsiveness in action!
The CSS for the site is authored using LESS, which plays well with Bootstrap. I'm compiling/minifying/concatenating the CSS and JS using CodeKit, an amazing Mac OS X app that makes development a breeze.
Typekit
For web fonts, it's hard to beat Typekit.
Subtle Patterns
I needed some patterns to use on the site, but I was frustrated with the licensing terms on many pattern sites I was finding. And then I found Subtle Patterns. Gorgeous, subtle patterns, liberally licensed. And hey, their site is WordPress powered too!
Posts 2 Posts
The site has the concepts of Departments, Needs, and Products. Each Department has multiple Needs. Each Need has multiple Products. I used Scribu's phenomenal Posts 2 Posts plugin to handle these relationships.

Here's the basic Posts 2 Posts connection code:
<?php
function hbns_register_p2p_relationships() {
if ( !function_exists( 'p2p_register_connection_type' ) )
return;
// Connect Departments to Needs
p2p_register_connection_type( array(
'name' => 'departments_to_needs',
'from' => 'department',
'to' => 'need',
'sortable' => 'to',
'admin_box' => 'to',
'admin_column' => 'any',
'cardinality' => 'one-to-many',
) );
// Connect Needs to Products
p2p_register_connection_type( array(
'name' => 'needs_to_products',
'from' => 'need',
'to' => 'product',
'sortable' => 'from',
'admin_column' => 'any',
'admin_box' => array(
'show' => 'any',
'context' => 'advanced',
),
'cardinality' => 'many-to-many',
'fields' => array(
'description' => 'Description',
),
) );
}
add_action( 'wp_loaded', 'hbns_register_p2p_relationships' );
I created a Custom Post Type for each of Departments, Needs, and Products, and connected them all using Posts 2 Posts. The connection between a Need and a Product also contains description metadata, as seen here:

Since Posts 2 Posts was a required plugin for the site to function, I didn't want there to be any possibility of accidental deactivation. So I wrote a quick mu-plugins drop-in to "lock" certain plugins on.
<?php
class HBNS_Always_Active_Plugins {
static $instance;
private $always_active_plugins;
function __construct() {
$this->always_active_plugins = array(
'batcache/batcache.php',
'posts-to-posts/posts-to-posts.php',
'login-logo/login-logo.php',
'manual-control/manual-control.php',
);
foreach ( $this->always_active_plugins as $p ) {
add_filter( 'plugin_action_links_' . plugin_basename( $p ), array( $this, 'remove_deactivation_link' ) );
}
add_filter( 'option_active_plugins', array( $this, 'active_plugins' ) );
}
function remove_deactivation_link( $actions ) {
unset( $actions['deactivate'] );
return $actions;
}
function active_plugins( $plugins ) {
foreach ( $this->always_active_plugins as $p ) {
if ( !array_search( $p, $plugins ) )
$plugins[] = $p;
}
return $plugins;
}
}
new HBNS_Always_Active_Plugins;
Custom Post Types
I'm using the Products post type in a slightly odd way. You don't ever go to a product URL. You instead go the URL for the Need that the Product fulfills, and that page lists all of the connected Products. As such, I wanted to make it so that URLs for products pointed to their Need, and I wanted to add an admin bar Edit link for the primary product on its Need page.
<?php
/*
Plugin Name: Post Links
Version: 0.1
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/
// Convenience methods
if(!class_exists('CWS_Plugin_v2')){class CWS_Plugin_v2{function hook($h){$p=10;$m=$this->sanitize_method($h);$b=func_get_args();unset($b[0]);foreach((array)$b as $a){if(is_int($a))$p=$a;else $m=$a;}return add_action($h,array($this,$m),$p,999);}private function sanitize_method($m){return str_replace(array('.','-'),array('_DOT_','_DASH_'),$m);}}}
// The plugin
class CWS_HBNS_Post_Links_Plugin extends CWS_Plugin_v2 {
public static $instance;
public function __construct() {
self::$instance = $this;
$this->hook( 'plugins_loaded' );
}
public function plugins_loaded() {
$this->hook( 'post_type_link' );
$this->hook( 'add_admin_bar_menus' );
}
public function add_admin_bar_menus() {
$this->hook( 'admin_bar_menu', 81 );
}
public function admin_bar_menu( $bar ) {
if ( is_single() && 'need' == get_queried_object()->post_type ) {
$primary_product = new WP_Query( array(
'connected_type' => 'needs_to_products',
'connected_items' => get_queried_object(),
) );
if ( $primary_product->have_posts() ) {
$bar->add_menu( array(
'id' => 'edit-primary-product',
'title' => 'Edit Primary Product',
'href' => get_edit_post_link( $primary_product->posts[0] ),
) );
}
}
}
public function post_type_link( $link, $post ) {
switch ( $post->post_type ) {
case 'product' :
$need = new WP_Query( array(
'connected_type' => 'needs_to_products',
'connected_items' => $post,
) );
if ( $need->have_posts() )
return get_permalink( $need->posts[0] );
break;
}
return $link;
}
}
new CWS_HBNS_Post_Links_Plugin;
For entering data about Products, I made a custom Meta Box that provided a simple interface for entering the Amazon.com link, the approximate price, and then a freeform textarea for key/value pairs and miscellaneous bullet points.

Misc
Because I'm using a Git-backed and Capistrano-deployed repo, I don't want any local file editing. So I dropped this code in:
<?php
define( 'DISALLOW_FILE_EDIT', true );
function hbns_disable_plugin_deletion( $actions ) {
unset( $actions['delete'] );
return $actions;
}
add_action( 'plugin_action_links', 'hbns_disable_plugin_deletion' );
I was playing a lot with different Product thumbnail sizes, so Viper007Bond's Regenerate Thumbnails plugin was invaluable, for going back and reprocessing the images I'd uploaded.
And of course, no WordPress developer should make a site without Debug Bar and Debug Bar Console.
Nginx and PHP-FPM
My server runs Nginx and PHP-FPM, in lieu of Apache and mod_php. My normal setup is to use Batcache with an APC backend to do HTML output caching, but I also have an Nginx "microcache" that caches anonymous page views for a short amount of time (5 seconds). But with this site, I wanted to cache more aggressively. Because there are no comments, the site's content remains static unless we change it. So I cranked my microcache up to 10 minutes (I guess it's not a microcache anymore!). But I wanted a way to purge the cache if a Product or Post was updated, without having to wait up to 10 minutes. So I modified the Nginx config to recognize a special header that would force a dynamic page load, effectively updating the cache.
Here's the relevant part of the Nginx config:
location ~ \.php$ {
# Set some proxy cache stuff
fastcgi_cache microcache_fpm;
fastcgi_cache_key $scheme$host$request_method$request_uri;
fastcgi_cache_valid 200 304 10m;
fastcgi_cache_use_stale updating;
fastcgi_max_temp_file_size 1M;
set $no_cache_set 0;
set $no_cache_get 0;
if ( $http_cookie ~* "comment_author_|wordpress_(?!test_cookie)|wp-postpass_" ) {
set $no_cache_set 1;
set $no_cache_get 1;
}
# If a request comes in with a X-Nginx-Cache-Purge: 1 header, do not grab from cache
# But note that we will still store to cache
# We use this to proactively update items in the cache!
if ( $http_x_nginx_cache_purge ) {
set $no_cache_get 1;
}
# For cached requests, tell client to hang on to them for 5 minutes
if ( $no_cache_set = 0 ) {
expires 5m;
}
# fastcgi_no_cache means "Do not store this proxy response in the cache"
fastcgi_no_cache $no_cache_set;
# fastcgi_cache_bypass means "Do not look in the cache for this request"
fastcgi_cache_bypass $no_cache_get;
include /etc/nginx/fastcgi_params;
fastcgi_index index.php;
try_files $uri =404;
fastcgi_pass phpfpm;
}
Now I just needed to have WordPress ping those URLs with that header to refresh them when something changed. Here's the "meat" of that code:
<?php
public function transition_post_status( $new, $old, $post ) {
if ( 'publish' !== $old && 'publish' !== $new )
return;
$post = get_post( $post );
$url = get_permalink( $post );
// Purge this URL
$this->purge( $url );
// Purge the front page
$this->purge( home_url( '/' ) );
// If a Product changes, flush its Need and that Need's Department
if ( 'product' === $post->post_type ) {
// Flush the connected need
$need = new WP_Query( array(
'connected_type' => 'needs_to_products',
'connected_items' => $post,
) );
if ( $need->have_posts() ) {
$this->purge( get_permalink( $need->posts[0] ) );
// Now this need's connected Department
$department = new WP_Query( array(
'connected_type' => 'departments_to_needs',
'connected_items' => $need->posts[0],
) );
if ( $department->have_posts() )
$this->purge( get_permalink( $department->posts[0] ) );
}
// If a Post changes, flush the main Blog page
} elseif ( 'post' === $post->post_type ) {
$this->purge( home_url( '/blog/' ) );
}
}
private function purge( $url ) {
wp_remote_get( $url, array( 'timeout' => 0.01, 'blocking' => false, 'headers' => array( 'X-Nginx-Cache-Purge' => '1' ) ) );
}
Boom. Now I get the benefit of long cache times, but with the ability to have updates go live quickly when I need to. The upshot here is that while I have Batcache installed, it's not really going to get a lot of use, as the outer Nginx caching layer should handle everything. This doesn't just mean that the site scales (Apache Bench has it handling many thousands of requests a second with ease), but that the site is really, really fast to browse. Your experience will vary according to network and geography, of course. But for me, I'm getting 34ms HTML delivery times for pages in the Nginx cache.
Questions?
So that's how I did it. Let me know if you have any questions!
15 May 2012 8:18pm GMT
Matt: Diary Of A WordCamp
With all the hubaboo going on about WordCamps right now, it's nice to read Siobhan McKeown's Diary Of A WordCamp on Smashing WordPress, a great story about her experience at WordCamp Netherlands.
15 May 2012 3:41pm GMT
14 May 2012
WordPress Planet
Matt: WP Businesses and Contributions
10up partner Helen is now a core WP contributor and 10up highlights that contribution on their blog. It's very exciting to see more core involvement springing up all over the WP ecosystem, as it has a big impact on the quality of the core software we all depend on. Let me know if you spot any more examples and I'll share them here.
14 May 2012 12:54am GMT




