What do you have in register_post_type()
?
Thread Starter
Luke
(@lukejanicke)
Here’s my full functions.php function.
function create_event_postype() {
$labels = array(
'name' => _x( 'Events', 'post type general name' ),
'singular_name' => _x( 'Event', 'post type singular name' ),
'all_items' => __( 'All Events' ),
'add_new' => _x( 'Add New', 'events' ),
'add_new_item' => __( 'Add New Event' ),
'edit_item' => __( 'Edit Event' ),
'new_item' => __( 'New Event' ),
'view_item' => __( 'View Event' ),
'search_items' => __( 'Search Events' ),
'not_found' => __( 'No events found' ),
'not_found_in_trash' => __( 'No events found in Trash' ),
'parent_item_colon' => '',
);
$args = array(
'label' => __( 'Events' ),
'labels' => $labels,
'public' => true,
'can_export' => true,
'show_ui' => true,
'_builtin' => false,
'capability_type' => 'post',
// 'menu_icon' => get_bloginfo( 'template_url' ).'/images/event.png',
'hierarchical' => false,
'has_archive' => true,
'rewrite' => array( "slug" => "events" ),
'supports'=> array( 'title', 'thumbnail', 'excerpt', 'editor' ),
'show_in_nav_menus' => true,
'taxonomies' => array( 'eventcategory', 'post_tag' )
);
register_post_type( 'events', $args );
flush_rewrite_rules( false ); // Either archive-events.php OR '/events' permalink needs this to work properly.
}
add_action( 'init', 'create_event_postype' );
Thread Starter
Luke
(@lukejanicke)
I tried changing the ‘rewrite’ value, but that didn’t affect the post class.
register_post_type( 'events', $args );
This is it.
The post_class()
(used in the loop template) just take it from there, so you have events
post type, it uses events
as is.
If you want just event
then just change it right there.
Thread Starter
Luke
(@lukejanicke)
Excellent. Thank you.
If I change that, it might mess with my already published ‘events’. I’ll just have to re-publish them after editing the code.