Make WordPress Core

Ticket #6357: taxes.php

File taxes.php, 1.1 KB (added by andy, 17 years ago)
Line 
1<?php
2/*
3Plugin Name: Taxes
4Plugin Author: Andy Skelton
5Author URI: http://skeltoac.com/
6*/
7
8add_action('init', 'taxes_init');
9add_action('activate_' . plugin_basename(__FILE__), 'taxes_activate');
10
11function taxes_activate() {
12        taxes_init();
13        $GLOBALS['wp_rewrite']->flush_rules();
14}
15
16function taxes_init() {
17        // replace the post_tag taxonomy with one that includes attachments.
18        register_taxonomy(
19                'post_tag',
20                array('post', 'attachment'),
21                array(
22                        'label' => __('Tags'),
23                        'template' => __('Tags: %2$l.'),
24                        'helps' => __('Separate tags with commas.'),
25                        'args' => array(),
26                        'rewrite' => array('slug' => 'tag'),
27                        'query_var' => 'tag',
28                )
29        );
30
31        // create a new taxonomy
32        register_taxonomy(
33                'people',
34                array('attachment:image', 'attachment:video', 'attachment:audio', 'post', 'page'),
35                array(
36                        'label' => __('People'),
37                        'template' => __('People: %2$l.'),
38                        'helps' => __('Separate people with commas.'),
39                        'sort' => true,
40                        'args' => array('orderby' => 'term_order'),
41                        'rewrite' => array('slug' => 'people'),
42                        'query_var' => 'people',
43                )
44        );
45}
46
47?>