Advertisement
delvinkrasniqi

Taxonomia/functions

Mar 27th, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. add_action( 'init', 'create_tag_taxonomies', 0 );
  2. //create two taxonomies, genres and tags for the post type "tag"
  3. function create_tag_taxonomies()
  4. {
  5. // Add new taxonomy, NOT hierarchical (like tags)
  6. $labels = array(
  7. 'name' => _x( 'Custom Tags', 'taxonomy general name' ),
  8. 'singular_name' => _x( 'Custom Tag', 'taxonomy singular name' ),
  9. 'search_items' => __( 'Search Tags' ),
  10. 'popular_items' => __( 'Popular Tags' ),
  11. 'all_items' => __( 'All Tags' ),
  12. 'parent_item' => null,
  13. 'parent_item_colon' => null,
  14. 'edit_item' => __( 'Edit Tag' ),
  15. 'update_item' => __( 'Update Tag' ),
  16. 'add_new_item' => __( 'Add New Tag' ),
  17. 'new_item_name' => __( 'New Tag Name' ),
  18. 'separate_items_with_commas' => __( 'Separate tags with commas' ),
  19. 'add_or_remove_items' => __( 'Add or remove tags' ),
  20. 'choose_from_most_used' => __( 'Choose from the most used tags' ),
  21. 'menu_name' => __( 'Custom Tags' ),
  22. );
  23.  
  24. register_taxonomy('tagsu','gallery' ,array(
  25. 'hierarchical' => false,
  26. 'labels' => $labels,
  27. 'show_ui' => true,
  28. 'update_count_callback' => '_update_post_term_count',
  29. 'query_var' => true,
  30. 'rewrite' => array( 'slug' => 'tags' ),
  31. ));
  32.  
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement