[wp-hackers] Person tagging?

Matt Mullenweg m at mullenweg.com
Fri Jan 22 00:54:45 UTC 2010


On 2010-01-21 10:01 AM, Otto wrote:
> Any idea how Matt implemented person tagging for his photo albums?
>
> Example: http://ma.tt/person/jane-wells/
>
> I assume it's a custom taxonomy method, but I was wondering if there
> was a plugin to do it or if it's custom code or what...

<?php
/*
Plugin Name: My taxonomies
Plugin Author: Matt Mullenweg
*/

add_action('init', 'taxes_init');
add_action('activate_' . plugin_basename(__FILE__), 'taxes_activate');

function taxes_activate() {
         taxes_init();
         $GLOBALS['wp_rewrite']->flush_rules();
}

function taxes_init() {
         global $wp_rewrite;

         // create a new taxonomy
         register_taxonomy(
                 'people',
                 array('attachment:image', 'attachment:video', 
'attachment:audio', 'post', 'page'),
                 array(
                         'label' => __('People'),
                         'template' => __('People: %l.'),
                         'helps' => __('Separate people with commas.'),
                         'sort' => true,
                         'args' => array('orderby' => 'term_order'),
                         'rewrite' => array('slug' => 'person'),
                 )
         );
}

-- 
Matt Mullenweg
http://ma.tt | http://wordpress.org | http://automattic.com


More information about the wp-hackers mailing list