Created
February 8, 2012 15:26
-
-
Save remkus/1770438 to your computer and use it in GitHub Desktop.
Custom Post Type
This file contains 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 | |
/** | |
* Custom Post Type with matching Custom Taxonomy. Only thing missing is how to | |
* get the following permalink: /tips/taxonomy-name/postname | |
* | |
*/ | |
register_post_type( 'Tips', array( | |
'label' => 'Tips', | |
'description' => 'Various tips', | |
'public' => true, | |
'show_ui' => true, | |
'show_in_menu' => true, | |
'capability_type' => 'post', | |
'hierarchical' => false, | |
'rewrite' => array( 'slug' => ''), | |
'query_var' => true, | |
'has_archive' => true, | |
'supports' => array( | |
'title', | |
'editor', | |
'excerpt', | |
'trackbacks', | |
'custom-fields', | |
'comments', | |
'revisions', | |
'thumbnail', | |
'author', | |
'page-attributes', | |
), | |
'taxonomies' => array( 'tip-categorie', ), | |
'labels' => array ( | |
'name' => 'Tips', | |
'singular_name' => 'Tip', | |
'menu_name' => 'Tips', | |
'add_new' => 'Add Tip', | |
'add_new_item' => 'Add New Tip', | |
'edit' => 'Edit', | |
'edit_item' => 'Edit Tip', | |
'new_item' => 'New Tip', | |
'view' => 'View Tip', | |
'view_item' => 'View Tip', | |
'search_items' => 'Search Tips', | |
'not_found' => 'No Tips Found', | |
'not_found_in_trash' => 'No Tips Found in Trash', | |
'parent' => 'Parent Tip', | |
), | |
) | |
); | |
register_taxonomy( 'tip-categorie', | |
array ( | |
0 => 'tips',), | |
array( | |
'hierarchical' => false, | |
'label' => 'Tip categoriën', | |
'show_ui' => true, | |
'query_var' => true, | |
'rewrite' => array( | |
'slug' => '' | |
), | |
'singular_label' => 'Tip categorie' | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment