File: /var/www/html/wp-content/themes/ganryujima_new_1602/lib/init.php
<?php
/* サムネイルのサイズ設定 */
add_image_size( '4-3', 480, 360, true );
add_image_size( '3-2', 480, 320, true );
add_image_size( '16-9', 480, 270, true );
add_image_size( 'icon', 230, 230, true );
/**
* 武道とはのカスタム投稿タイプを作成
*/
add_action('init', 'define_budo');
function define_budo() {
register_post_type('grjm_budo', array(
'label' => '巌流島ブロマガ',
'public' => true,
'menu_icon' => 'dashicons-megaphone',
'supports'=> array('title', 'editor', 'thumbnail'),
'rewrite' => false
));
}
/**
* 大会のカスタム投稿タイプを作成
*/
add_action('init', 'define_events');
function define_events() {
register_post_type('grjm_events', array(
'label' => 'イベント情報',
'public' => true,
'menu_icon' => 'dashicons-tickets-alt',
'supports'=> array('title', 'editor', 'thumbnail'),
'rewrite' => false
));
}
/**
* 大会結果のカスタム投稿タイプを作成
*/
add_action('init', 'define_event_results');
function define_event_results() {
register_post_type('grjm_event_results', array(
'label' => '試合結果',
'public' => true,
'menu_icon' => 'dashicons-calendar-alt',
'supports'=> array('title', 'editor', 'thumbnail'),
'rewrite' => false
));
}
/**
* 議論のカスタム投稿タイプを作成
*/
add_action('init', 'define_discussion');
function define_discussion() {
register_post_type('grjm_discussion', array(
'label' => '議論',
'public' => true,
'menu_icon' => 'dashicons-format-chat',
'supports'=> array('title', 'editor', 'thumbnail', 'comments'),
));
}
/**
* テレビのカスタム投稿タイプを作成
*/
add_action('init', 'define_tv');
function define_tv() {
register_post_type('grjm_tv', array(
'label' => 'テレビ情報',
'public' => true,
'menu_icon' => 'dashicons-desktop',
'supports'=> array('title', 'editor', 'thumbnail', 'comments'),
));
}
/**
* ファイターのカスタム投稿タイプを作成
*/
add_action('init', 'define_fighter');
function define_fighter() {
register_post_type('grjm_fighter', array(
'label' => 'ファイター',
'public' => true,
'menu_icon' => 'dashicons-groups',
'supports' => array('title', 'editor', 'thumbnail'),
'rewrite' => false
));
/**
* ファイターの階級タグを作成
*/
register_taxonomy(
'fighter-weight',
'grjm_fighter',
array(
'hierarchical' => false,
'update_count_callback' => '_update_post_term_count',
'label' => '階級',
'singular_label' => '階級',
'public' => true,
'show_ui' => true
)
);
/**
* ファイターの出身格闘技タグを作成
*/
register_taxonomy(
'fighter-base',
'grjm_fighter',
array(
'hierarchical' => false,
'update_count_callback' => '_update_post_term_count',
'label' => '出身格闘技',
'singular_label' => '出身格闘技',
'public' => true,
'show_ui' => true
)
);
}
// 画像にカテゴリーを付ける
add_action('init', 'add_category_to_attachment');
function add_category_to_attachment() {
register_taxonomy_for_object_type('category','attachment');
}
/**
* 抜粋の文字数制限
*/
function custom_excerpt_length( $length ) {
return 70;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
/**
* 抜粋の末尾変更
*/
function new_excerpt_more($more) {
return '...';
}
add_filter('excerpt_more', 'new_excerpt_more');
?>