functions.php
if ( ! function_exists('generate_concerts_post_type') ) {
// Register Custom Post Type
function generate_concerts_post_type() {
$labels = array(
'name' => _x( 'Concerts', 'Post Type General Name', 'ale' ),
'singular_name' => _x( 'Concert', 'Post Type Singular Name', 'ale' ),
'menu_name' => __( 'Concerts', 'ale' ),
'name_admin_bar' => __( 'Concerts', 'ale' ),
'parent_item_colon' => __( 'Parent Item:', 'ale' ),
'all_items' => __( 'All Concerts', 'ale' ),
'add_new_item' => __( 'Add New Concert', 'ale' ),
'add_new' => __( 'Add New', 'ale' ),
'new_item' => __( 'New Item', 'ale' ),
'edit_item' => __( 'Edit Item', 'ale' ),
'update_item' => __( 'Update Item', 'ale' ),
'view_item' => __( 'View Item', 'ale' ),
'search_items' => __( 'Search Item', 'ale' ),
'not_found' => __( 'Not found', 'ale' ),
'not_found_in_trash' => __( 'Not found in Trash', 'ale' ),
);
$rewrite = array(
'slug' => 'concerts',
'with_front' => true,
'pages' => true,
'feeds' => true,
);
$args = array(
'label' => __( 'Concert', 'ale' ),
'description' => __( 'Concerts Description', 'ale' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'revisions', ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-format-audio',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'rewrite' => $rewrite,
'capability_type' => 'page',
);
register_post_type( 'concerts', $args );
}
add_action( 'init', 'generate_concerts_post_type', 0 );
}
add_action( 'after_switch_theme', 'twenty_refresh_permalinks' );
function twenty_refresh_permalinks() {
generate_concerts_post_type();
flush_rewrite_rules();
}
add_filter( 'enter_title_here', 'twenty_enter_title_placeholder', 10, 2 );
function twenty_enter_title_placeholder( $enter_title, $post ) {
if ( 'concerts' === get_post_type( $post ) ) {
return 'tonto';
}
return $enter_title;
}