Skip to content

Instantly share code, notes, and snippets.

@shield-9 shield-9/functions.php Secret
Created Aug 30, 2014

Embed
What would you like to do?
#WordPress-ja-forum-138162
<?php
function register_discount_post_type() {
register_post_type('discount', array(
'label' => '値引き額',
'description' => '',
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'capability_type' => 'post',
'hierarchical' => true,
'query_var' => true,
'has_archive' => true,
'supports' => array('title','editor','revisions'),
) );
}
function re_register_category_taxonomy() {
global $wp_rewrite;
$rewrite = array(
'hierarchical' => true,
'slug' => get_option('category_base') ? get_option('category_base') : 'category',
'with_front' => ! get_option('category_base') || $wp_rewrite->using_index_permalinks(),
'ep_mask' => EP_CATEGORIES,
);
register_taxonomy( 'category', array("post","discount"), array(
'hierarchical' => true,
'query_var' => 'category_name',
'rewrite' => $rewrite,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'_builtin' => true,
) );
}
add_action( 'init', 'register_discount_post_type', 1 );
add_action( 'init', 're_register_category_taxonomy', 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.