Created
February 11, 2013 17:37
-
-
Save technosailor/4756021 to your computer and use it in GitHub Desktop.
CPT
This file contains hidden or 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 | |
class Example_Plugin_Class { | |
public function __construct() | |
{ | |
$this->hooks(); | |
} | |
protected function hooks() | |
{ | |
add_action( 'init', array( $this, 'hooks' ) ); | |
} | |
protected function cpt() | |
{ | |
register_post_type( 'reviews', array( | |
'label' => 'Reviews', | |
'labels' => array( | |
'name' => 'Reviews', | |
'singular_name' => 'Review', | |
'add_new_item' => 'Add New Review', | |
'edit_item' => 'Edit Review', | |
'new_item' => 'New Review', | |
'view_item' => 'View Review', | |
'search_items' => 'Search Reviews', | |
), | |
'description' => 'User-generated reviews', | |
'public' => true, | |
'show_in_nav_menus' => false, | |
'show_in_menu' => true, | |
'show_in_admin_bar' => false, | |
'supports' => array( | |
'title', | |
'editor', | |
'author', | |
'excerpt', | |
'custom-fields', | |
'comments' | |
), | |
'menu_icon' => get_option('siteurl') . '/wp-content/plugins/example-plugin/images/reviews-icon.png', | |
) | |
); | |
} | |
} | |
new Example_Plugin_Class; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Maybe it's just me, but this function seems like it's slated for disaster:
Should probably be this: