Last active
August 29, 2015 14:06
-
-
Save lunaluna/4751013dc95d3f0e422d to your computer and use it in GitHub Desktop.
【WordPress】カスタム投稿タイプ「新着記事(news)」を register_post_type で登録
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// カスタム投稿タイプ「新着記事(news)」 | |
add_action( 'init', 'news_custom_post_type' ); | |
function news_custom_post_type() { | |
$labels = array( | |
'name' => _x( '新着記事', 'post type general name' ), | |
'singular_name' => _x( '新着記事', 'post type singular name' ), | |
'add_new' => _x( '新しい新着記事を追加', 'news' ), | |
'add_new_item' => __( '新しい新着記事を追加' ), | |
'edit_item' => __( '新着記事を編集' ), | |
'new_item' => __( '新しい新着記事' ), | |
'view_item' => __( '新着記事を編集' ), | |
'search_items' => __( '新着記事を探す' ), | |
'not_found' => __( '新着記事はありません' ), | |
'not_found_in_trash' => __( 'ゴミ箱に新着記事はありません' ), | |
'parent_item_colon' => '' | |
); | |
$args = array( | |
'labels' => $labels, | |
'public' => true, | |
'publicly_queryable' => true, | |
'show_ui' => true, | |
'query_var' => true, | |
'rewrite' => true, | |
'capability_type' => 'post', | |
'menu_position' => 5, | |
'hierarchical' => false, | |
'supports' => array( 'title', 'page-attributes', 'editor' ), | |
'has_archive' => true | |
); | |
register_post_type( 'news', $args ); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment