Skip to content

Instantly share code, notes, and snippets.

@inc2734
Created November 11, 2015 01:27
Show Gist options
  • Save inc2734/b79c7c18e02b00d0072f to your computer and use it in GitHub Desktop.
Save inc2734/b79c7c18e02b00d0072f to your computer and use it in GitHub Desktop.
Register custom post type on Habakiri
<?php
function habakiri_child_theme_setup() {
class Habakiri extends Habakiri_Base_Functions {
public function __construct() {
parent::__construct();
add_action( 'init', array( $this, 'register_post_types' ) );
}
/**
* カスタム投稿タイプを定義
*/
public function register_post_types() {
register_post_type( 'comment', array(
'labels' => array(
'name' => '新着情報',
'singular_name' => '新着情報',
'menu_name' => '新着情報',
'name_admin_bar' => '新着情報',
'add_new_item' => '新着情報を追加',
'new_item' => '新着情報を追加',
'edit_item' => '新着情報を編集',
'view_item' => '新着情報を表示',
'all_items' => '新着情報一覧',
'search_items' => '新着情報を検索',
'not_found' => '新着情報が見つかりませんでした。',
'not_found_in_trash' => 'ゴミ箱に新着情報はありません。',
),
'public' => true,
'has_archive' => true,
'rewrite' => array(
'with_front' => false,
),
'supports' => array(
'title', 'editor', 'thumbnail',
),
) );
}
}
}
add_action( 'after_setup_theme', 'habakiri_child_theme_setup' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment