WordPress 3.1 at DC PHP

Post on 02-Jul-2015

3210 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

My lightning talk on WordPress 3.1 at the DC PHP December meetup. Intenr

Transcript

WordPress 3.1 DC PHP

@nacin Andrew Nacin

andrewnacin.com nacin@wordpress.org

What’s next?

Post formats

Admin bar

Internal linking

Incremental improvements

UI & UX (always)

AJAX goodness

Network Admin

Taxonomy queries

query_posts('cat=123&author=456');  

query_posts(array(      'cat'  =>  123,      'author'  =>  456,  )  );  

$myquery['cat']  =  123;  $myquery['author']  =  456;  query_posts(  $myquery  );  

And

Tag A and Tag B and Tag C

Or

Category A or Category B

Not

Neither Category A nor B

And

tag__and, category__and

Or

tag__in, category__in

Not

tag__not_in, category__not_in

And across taxonomies

Tag A and Category B

Or across taxonomies

Tag A or Category B

Not across taxonomies

Neither Tag A nor Category B

$myquery['tax_query']  =  array(     array(       'taxonomy'  =>  'category',       'terms'  =>  array('foo'),       'field'  =>  'slug',     ),     array(       'taxonomy'  =>  'post_tag',       'terms'  =>  array('bar'),       'field'  =>  'slug',     ),  );  query_posts(  $myquery  );  

$myquery['tax_query']  =  array(     array(       'taxonomy'  =>  'category',       'terms'  =>  array('foo',  'bar'),       'field'  =>  'slug',       'operator'  =>  'NOT  IN',     ),  );  query_posts(  $myquery  );  

$myquery['tax_query']  =  array(     'relation'  =>  'OR',     array(       'taxonomy'  =>  'category',       'terms'  =>  array('foo'),       'field'  =>  'slug',     ),     array(       'taxonomy'  =>  'post_tag',       'terms'  =>  array('bar'),       'field'  =>  'slug',     ),  );  query_posts(  $myquery  );  

http://otto42.com/81 (required reading)

Custom post types

  register_post_type(  'members',        array(       'labels'  =>  array(         'name'  =>  'Members',         'singular_name'  =>  'Member',         ),       'public'  =>  true,       'show_ui'  =>  true,       'rewrite'  =>  array(         'slug'  =>  'member',         ),       'has_archive'  =>  true,     )  );  

  register_post_type(  'members',        array(       'labels'  =>  array(         'name'  =>  'Members',         'singular_name'  =>  'Member',         ),       'public'  =>  true,       'show_ui'  =>  true,       'rewrite'  =>  array(         'slug'  =>  'member',         ),       'has_archive'  =>  'team',     )  );  

/team/ /member/nacin/

archive-­‐members.php  single-­‐members.php  

Have fun breaking

WordPress

Beta 2 will be released

tomorrow

top related