Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

tambourdeville on "Custom post type and permalinks"

$
0
0

Hi all!
I have an issue with my plugin:
I want to declare a custom post-type "flip_pong", in a class "flippong".
Untill here, everything is ok. The issue happens when I want to see a post of this CTP with pretty permalinks: 404 error !

I know I have to call flush_rewrite_rules() to rewrite the permalinks structure. So I call it at the plugin activation. Everything seems to work, except that I still have a 404 when I want to see a post.

If anyone have an idea about what I'm doing wrong..
Here's my code:

class flippong{
function create_flippong_post_types() {
	register_post_type( 'flip_pong',
		array(
			'labels' => array(
				'name' => __( 'Flipbooks' ),
				'singular_name' => __( 'Flipbook' ),
					'add_new' => __( 'add new' ),
					'add_new_item' => __( 'add a FlipBook' ),
					'edit' => __( 'edit' ),
					'edit_item' => __( 'edit FlipBook' ),
					'new_item' => __( 'new FlipBook;' ),
					'view' => __( 'see' ),
					'view_item' => __( 'see FlipBook' ),
					'search_items' => __( 'search FlipBook' ),
					'not_found' => __( 'no FlipBook found' ),
							),
			'public' => true,
			'taxonomies' => array('category'),
			'show_ui' => true,
			'publicly_queryable' => true,
			'rewrite' => array( 'slug' => 'flip_pong' ),
			'menu_icon' => plugins_url().'/flip-pong-v/images/book.png',
			'supports' => array('title','editor','thumbnail')
		)
	);
}

}//end class
add_action('init', array('flippong','create_flippong_post_types' ));
register_activation_hook( __FILE__, array('flippong','create_flippong_post_types' ) );
register_activation_hook( __FILE__, 'flush_rewrite_rules' );
register_deactivation_hook( __FILE__, 'flush_rewrite_rules' );

Viewing all articles
Browse latest Browse all 8245

Trending Articles