WordPress.org

Make WordPress Core

Ticket #19471: test-core-archive-page-with-custom-post-type.php

File test-core-archive-page-with-custom-post-type.php, 636 bytes (added by chrisbliss18, 2 years ago)
Line 
1<?php
2/*
3Plugin Name: Test Core Archive Page with Custom Post Type
4Description: This is for Trac ticket #19471. It creates a custom post type called "Product" and adds the Category and Tag taxonomies to it.
5Author: Chris Jean
6*/
7
8add_action( 'init', 'create_post_type' );
9function create_post_type() {
10        register_post_type( 'acme_product',
11                array(
12                        'labels' => array(
13                                'name' => __( 'Products' ),
14                                'singular_name' => __( 'Product' )
15                        ),
16                'public' => true,
17                'has_archive' => true,
18                )
19        );
20       
21        register_taxonomy_for_object_type( 'category', 'acme_product' );
22        register_taxonomy_for_object_type( 'post_tag', 'acme_product' );
23}