|
|
@@ -14,12 +14,19 @@ Developed by: Eddie Machado
|
|
|
URL: http://themble.com/bones/
|
|
|
*/
|
|
|
|
|
|
+// Flush rewrite rules for custom post types
|
|
|
+add_action( 'after_switch_theme', 'bones_flush_rewrite_rules' );
|
|
|
+
|
|
|
+// Flush your rewrite rules
|
|
|
+function bones_flush_rewrite_rules() {
|
|
|
+ flush_rewrite_rules();
|
|
|
+}
|
|
|
|
|
|
// let's create the function for the custom type
|
|
|
function custom_post_example() {
|
|
|
// creating (registering) the custom type
|
|
|
register_post_type( 'custom_type', /* (http://codex.wordpress.org/Function_Reference/register_post_type) */
|
|
|
- // let's now add all the options for this post type
|
|
|
+ // let's now add all the options for this post type
|
|
|
array( 'labels' => array(
|
|
|
'name' => __( 'Custom Types', 'bonestheme' ), /* This is the Title of the Group */
|
|
|
'singular_name' => __( 'Custom Post', 'bonestheme' ), /* This is the individual type */
|
|
|
@@ -49,7 +56,7 @@ function custom_post_example() {
|
|
|
'hierarchical' => false,
|
|
|
/* the next one is important, it tells what's enabled in the post editor */
|
|
|
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'sticky')
|
|
|
- ) /* end of options */
|
|
|
+ ) /* end of options */
|
|
|
); /* end of register post type */
|
|
|
|
|
|
/* this adds your post categories to your custom post type */
|
|
|
@@ -57,7 +64,7 @@ function custom_post_example() {
|
|
|
/* this adds your post tags to your custom post type */
|
|
|
register_taxonomy_for_object_type( 'post_tag', 'custom_type' );
|
|
|
|
|
|
-}
|
|
|
+}
|
|
|
|
|
|
// adding the function to the Wordpress init
|
|
|
add_action( 'init', 'custom_post_example');
|
|
|
@@ -68,55 +75,55 @@ function custom_post_example() {
|
|
|
*/
|
|
|
|
|
|
// now let's add custom categories (these act like categories)
|
|
|
- register_taxonomy( 'custom_cat',
|
|
|
- array('custom_type'), /* if you change the name of register_post_type( 'custom_type', then you have to change this */
|
|
|
- array('hierarchical' => true, /* if this is true, it acts like categories */
|
|
|
- 'labels' => array(
|
|
|
- 'name' => __( 'Custom Categories', 'bonestheme' ), /* name of the custom taxonomy */
|
|
|
- 'singular_name' => __( 'Custom Category', 'bonestheme' ), /* single taxonomy name */
|
|
|
- 'search_items' => __( 'Search Custom Categories', 'bonestheme' ), /* search title for taxomony */
|
|
|
- 'all_items' => __( 'All Custom Categories', 'bonestheme' ), /* all title for taxonomies */
|
|
|
- 'parent_item' => __( 'Parent Custom Category', 'bonestheme' ), /* parent title for taxonomy */
|
|
|
- 'parent_item_colon' => __( 'Parent Custom Category:', 'bonestheme' ), /* parent taxonomy title */
|
|
|
- 'edit_item' => __( 'Edit Custom Category', 'bonestheme' ), /* edit custom taxonomy title */
|
|
|
- 'update_item' => __( 'Update Custom Category', 'bonestheme' ), /* update title for taxonomy */
|
|
|
- 'add_new_item' => __( 'Add New Custom Category', 'bonestheme' ), /* add new title for taxonomy */
|
|
|
- 'new_item_name' => __( 'New Custom Category Name', 'bonestheme' ) /* name title for taxonomy */
|
|
|
- ),
|
|
|
- 'show_admin_column' => true,
|
|
|
- 'show_ui' => true,
|
|
|
- 'query_var' => true,
|
|
|
- 'rewrite' => array( 'slug' => 'custom-slug' ),
|
|
|
- )
|
|
|
- );
|
|
|
-
|
|
|
+ register_taxonomy( 'custom_cat',
|
|
|
+ array('custom_type'), /* if you change the name of register_post_type( 'custom_type', then you have to change this */
|
|
|
+ array('hierarchical' => true, /* if this is true, it acts like categories */
|
|
|
+ 'labels' => array(
|
|
|
+ 'name' => __( 'Custom Categories', 'bonestheme' ), /* name of the custom taxonomy */
|
|
|
+ 'singular_name' => __( 'Custom Category', 'bonestheme' ), /* single taxonomy name */
|
|
|
+ 'search_items' => __( 'Search Custom Categories', 'bonestheme' ), /* search title for taxomony */
|
|
|
+ 'all_items' => __( 'All Custom Categories', 'bonestheme' ), /* all title for taxonomies */
|
|
|
+ 'parent_item' => __( 'Parent Custom Category', 'bonestheme' ), /* parent title for taxonomy */
|
|
|
+ 'parent_item_colon' => __( 'Parent Custom Category:', 'bonestheme' ), /* parent taxonomy title */
|
|
|
+ 'edit_item' => __( 'Edit Custom Category', 'bonestheme' ), /* edit custom taxonomy title */
|
|
|
+ 'update_item' => __( 'Update Custom Category', 'bonestheme' ), /* update title for taxonomy */
|
|
|
+ 'add_new_item' => __( 'Add New Custom Category', 'bonestheme' ), /* add new title for taxonomy */
|
|
|
+ 'new_item_name' => __( 'New Custom Category Name', 'bonestheme' ) /* name title for taxonomy */
|
|
|
+ ),
|
|
|
+ 'show_admin_column' => true,
|
|
|
+ 'show_ui' => true,
|
|
|
+ 'query_var' => true,
|
|
|
+ 'rewrite' => array( 'slug' => 'custom-slug' ),
|
|
|
+ )
|
|
|
+ );
|
|
|
+
|
|
|
// now let's add custom tags (these act like categories)
|
|
|
- register_taxonomy( 'custom_tag',
|
|
|
- array('custom_type'), /* if you change the name of register_post_type( 'custom_type', then you have to change this */
|
|
|
- array('hierarchical' => false, /* if this is false, it acts like tags */
|
|
|
- 'labels' => array(
|
|
|
- 'name' => __( 'Custom Tags', 'bonestheme' ), /* name of the custom taxonomy */
|
|
|
- 'singular_name' => __( 'Custom Tag', 'bonestheme' ), /* single taxonomy name */
|
|
|
- 'search_items' => __( 'Search Custom Tags', 'bonestheme' ), /* search title for taxomony */
|
|
|
- 'all_items' => __( 'All Custom Tags', 'bonestheme' ), /* all title for taxonomies */
|
|
|
- 'parent_item' => __( 'Parent Custom Tag', 'bonestheme' ), /* parent title for taxonomy */
|
|
|
- 'parent_item_colon' => __( 'Parent Custom Tag:', 'bonestheme' ), /* parent taxonomy title */
|
|
|
- 'edit_item' => __( 'Edit Custom Tag', 'bonestheme' ), /* edit custom taxonomy title */
|
|
|
- 'update_item' => __( 'Update Custom Tag', 'bonestheme' ), /* update title for taxonomy */
|
|
|
- 'add_new_item' => __( 'Add New Custom Tag', 'bonestheme' ), /* add new title for taxonomy */
|
|
|
- 'new_item_name' => __( 'New Custom Tag Name', 'bonestheme' ) /* name title for taxonomy */
|
|
|
- ),
|
|
|
- 'show_admin_column' => true,
|
|
|
- 'show_ui' => true,
|
|
|
- 'query_var' => true,
|
|
|
- )
|
|
|
- );
|
|
|
-
|
|
|
- /*
|
|
|
- looking for custom meta boxes?
|
|
|
- check out this fantastic tool:
|
|
|
- https://github.com/jaredatch/Custom-Metaboxes-and-Fields-for-WordPress
|
|
|
- */
|
|
|
+ register_taxonomy( 'custom_tag',
|
|
|
+ array('custom_type'), /* if you change the name of register_post_type( 'custom_type', then you have to change this */
|
|
|
+ array('hierarchical' => false, /* if this is false, it acts like tags */
|
|
|
+ 'labels' => array(
|
|
|
+ 'name' => __( 'Custom Tags', 'bonestheme' ), /* name of the custom taxonomy */
|
|
|
+ 'singular_name' => __( 'Custom Tag', 'bonestheme' ), /* single taxonomy name */
|
|
|
+ 'search_items' => __( 'Search Custom Tags', 'bonestheme' ), /* search title for taxomony */
|
|
|
+ 'all_items' => __( 'All Custom Tags', 'bonestheme' ), /* all title for taxonomies */
|
|
|
+ 'parent_item' => __( 'Parent Custom Tag', 'bonestheme' ), /* parent title for taxonomy */
|
|
|
+ 'parent_item_colon' => __( 'Parent Custom Tag:', 'bonestheme' ), /* parent taxonomy title */
|
|
|
+ 'edit_item' => __( 'Edit Custom Tag', 'bonestheme' ), /* edit custom taxonomy title */
|
|
|
+ 'update_item' => __( 'Update Custom Tag', 'bonestheme' ), /* update title for taxonomy */
|
|
|
+ 'add_new_item' => __( 'Add New Custom Tag', 'bonestheme' ), /* add new title for taxonomy */
|
|
|
+ 'new_item_name' => __( 'New Custom Tag Name', 'bonestheme' ) /* name title for taxonomy */
|
|
|
+ ),
|
|
|
+ 'show_admin_column' => true,
|
|
|
+ 'show_ui' => true,
|
|
|
+ 'query_var' => true,
|
|
|
+ )
|
|
|
+ );
|
|
|
+
|
|
|
+ /*
|
|
|
+ looking for custom meta boxes?
|
|
|
+ check out this fantastic tool:
|
|
|
+ https://github.com/jaredatch/Custom-Metaboxes-and-Fields-for-WordPress
|
|
|
+ */
|
|
|
|
|
|
|
|
|
?>
|