Team Update: Twenty Twelve

We are the team formerly known as “Twenty Twelve Two”—now three strong with Drew Strojny joining up for the 3.4 release cycle as the theme designer. Welcome Drew!

What we’re calling our “first cycle” ends today with Drew delivering us the first working prototype with the basic layout in place. Matt committed it with r19842. (See also #19978.)

Consider this version 0.5

This is not yet a fully working theme—we’ll be adding in more features and lots of missing styles over the next 3–4 weeks. Including post formats, comments, archives and page templates, more in-post styling, and a nav menu rework so the main content comes ahead of the navigation.

Our goal for the next cylcle is to finish up all the missing visual styles from Drew, with Lance making relevant code changes as needed. Deliverable is a finished theme that everyone can start using and testing in earnest.

Schedule notes

1. Due to schedule conflicts we need to be going slowly over the next week or two, picking it up again in earnest Feb 20–Feb 29.
2. Office hours will probably be on Mondays, I’ll post the actual times soon.

Update: We’ll end our cycle on Feb 29th.

#bundled-theme, #team-update, #twentytwelve

New API in 3.3: is_main_query()

There’s a nifty new method for WP_Query that is available in 3.3: is_main_query().

This enables someone to hook into pre_get_posts and modify only the main query. No more checking for suppress_filters (which was wrong), or comparing against $wp_the_query (complicated), or using query_posts() in a template.

is_main_query(), the function, will return true if the current $wp_query is also the main query. (As an example, this would be false after query_posts() is called but before wp_reset_query() is called.) This is consistent with existing conditional tags — for example, is_page() refers to the main query, while is_page() can also be called against any WP_Query object.

Quick example (YMMV) —

add_action( 'pre_get_posts', 'nacin_modify_query_exclude_category' );
function nacin_modify_query_exclude_category( $query ) {
    if ( $query->is_main_query() && ! $query->get( 'cat' ) )
        $query->set( 'cat', '-5' );

For more: #18677

#3-3, #dev-notes