Explorar el Código

added default categories & tags
removed a duplicate custom taxonomy function

Eddie Machado hace 15 años
padre
commit
74ee3c76bc
Se han modificado 1 ficheros con 6 adiciones y 21 borrados
  1. 6 21
      library/custom-post-type.php

+ 6 - 21
library/custom-post-type.php

@@ -49,6 +49,12 @@ function custom_post_example() {
 			'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'sticky')
 			'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'sticky')
 	 	) /* end of options */
 	 	) /* end of options */
 	); /* end of register post type */
 	); /* end of register post type */
+	
+	/* this ads regular categories to your custom post type */
+	register_taxonomy_for_object_type('category', 'custom_type');
+	/* this ads regular tags to your custom post type */
+	register_taxonomy_for_object_type('post_tag', 'custom_type');
+	
 } 
 } 
 
 
 	// adding the function to the Wordpress init
 	// adding the function to the Wordpress init
@@ -74,27 +80,6 @@ function custom_post_example() {
     		'query_var' => true,
     		'query_var' => true,
     	)
     	)
     );   
     );   
-
-	// now let's add custom tags (http://codex.wordpress.org/Function_Reference/register_taxonomy) they are the same
-    register_taxonomy( 'custom_tags', 
-    	array('custom_type'), /* if you change the name of register_post_type( 'custom_type', then you have to change this */
-    	array('hierarchical' => true,                    
-    		'labels' => array(
-    			'name' => __( 'Custom Tags' ), /* name of the custom taxonomy */
-    			'singular_name' => __( 'Custom Tag' ), /* single taxonomy name */
-    			'search_items' =>  __( 'Search Custom Tags' ), /* search title for taxomony */
-    			'all_items' => __( 'All Custom Tags' ), /* all title for taxonomies */
-    			'parent_item' => __( 'Parent Custom Tag' ), /* parent title for taxonomy */
-    			'parent_item_colon' => __( 'Parent Custom Tag:' ), /* parent taxonomy title */
-    			'edit_item' => __( 'Edit Custom Tag' ), /* edit custom taxonomy title */
-    			'update_item' => __( 'Update Custom Tag' ), /* update title for taxonomy */
-    			'add_new_item' => __( 'Add New Custom Tag' ), /* add new title for taxonomy */
-    			'new_item_name' => __( 'New Custom Tag Name' ) /* name title for taxonomy */
-    		),
-    		'show_ui' => true,
-    		'query_var' => true,
-    	)
-    );
 	
 	
 
 
 ?>
 ?>