Make WordPress Core

Ticket #8731: test-taxonomies.php

File test-taxonomies.php, 966 bytes (added by azaozz, 16 years ago)

Simple plugin to test with

Line 
1<?php
2/*
3Plugin Name: Test taxonomies
4*/
5
6add_action('init', 'ttaxes_init');
7add_action('activate_' . plugin_basename(__FILE__), 'ttaxes_activate');
8
9function ttaxes_activate() {
10        ttaxes_init();
11        $GLOBALS['wp_rewrite']->flush_rules();
12}
13
14function ttaxes_init() {
15        global $wp_rewrite;
16
17        // create new taxonomies
18        register_taxonomy(
19                'things',
20                array('attachment:image', 'attachment:video', 'attachment:audio', 'post', 'page'),
21                array(
22                        'label' => __('Things'),
23                        'template' => __('Things: %l.'),
24                        'helps' => __('Separate with commas.'),
25                        'sort' => true,
26                        'args' => array('orderby' => 'term_order'),
27                        'rewrite' => array('slug' => 'thing'),
28                )
29        );
30
31        register_taxonomy(
32                'other_things',
33                array('attachment:image', 'attachment:video', 'attachment:audio', 'post', 'page'),
34                array(
35                        'label' => __('More things'),
36                        'template' => __('something: %l.'),
37                        'helps' => __('Separate with commas.'),
38                        'rewrite' => array('slug' => 'something'),
39                )
40        );
41}
42
43