Advertisement
pusatdata

KODE CATEGORY dan TAGS INDEPENDENT

Jun 14th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. KODE CATEGORY INDEPENDENT dan KODE TAGS INDEPENDENT
  2.  
  3. sebelumnya masukkan kode ini di functions.php:
  4. require_once('functions/theme-post-type.php');
  5.  
  6. juga telah dimasukkan dalam theme-post-type.php
  7. require_once('theme-taxonomy.php');
  8.  
  9. masukkan kode berikut dalam file theme-taxonomy.php:
  10.  
  11. <?php
  12.  
  13. add_action( 'init', 'katt_taxonomy', 0 );
  14. function katt_taxonomy() {
  15. $labels = array(
  16. 'name' => _x( 'Kategori Tausiyah', 'taxonomy general name' ),
  17. 'singular_name' => _x( 'Kategori Tausiyah', 'taxonomy singular name' ),
  18. 'search_items' => __( 'Cari Kategori' ),
  19. 'all_items' => __( 'Semua Kategori' ),
  20. 'parent_item' => null,
  21. 'parent_item_colon' => null,
  22. 'edit_item' => __( 'Edit Kategori' ),
  23. 'update_item' => __( 'Update Kategori' ),
  24. 'add_new_item' => __( 'Tambah Baru' ),
  25. 'new_item_name' => __( 'Tambah Kategori Baru' ),
  26. 'menu_name' => __( 'Kategori Tausiyah' ),
  27. );
  28. // Now register the taxonomy
  29. register_taxonomy('kat-tausiyah',array('tausiyah'), array(
  30. 'hierarchical' => true,
  31. 'labels' => $labels,
  32. 'show_ui' => true,
  33. 'show_admin_column' => true,
  34. 'query_var' => true,
  35. ));
  36. }
  37.  
  38.  
  39. add_action( 'init', 'topik_taxonomy', 0 );
  40.  
  41. function topik_taxonomy() {
  42.  
  43. // Labels part for the GUI
  44.  
  45. $labels = array(
  46. 'name' => _x( 'Topik Tausiyah', 'taxonomy general name' ),
  47. 'singular_name' => _x( 'Topik Tausiyah', 'taxonomy singular name' ),
  48. 'search_items' => __( 'Cari Tausiyah' ),
  49. 'popular_items' => __( 'Topik Terpopuler' ),
  50. 'all_items' => __( 'Semua Topik' ),
  51. 'parent_item' => null,
  52. 'parent_item_colon' => null,
  53. 'edit_item' => __( 'Edit Topik' ),
  54. 'update_item' => __( 'Update Topik' ),
  55. 'add_new_item' => __( 'Tambah Topik' ),
  56. 'new_item_name' => __( 'Nama Topik Baru' ),
  57. 'separate_items_with_commas' => __( 'Pisahkan topik dengan koma' ),
  58. 'add_or_remove_items' => __( 'Tambah atau kurangi topik' ),
  59. 'choose_from_most_used' => __( 'Pilih dari topik populer' ),
  60. 'menu_name' => __( 'Topik Tausiyah' ),
  61. );
  62.  
  63. // Now register the non-hierarchical taxonomy like tag
  64.  
  65. register_taxonomy('topik','tausiyah',array(
  66. 'hierarchical' => false,
  67. 'labels' => $labels,
  68. 'show_ui' => true,
  69. 'show_admin_column' => true,
  70. 'update_count_callback' => '_update_post_term_count',
  71. 'query_var' => true,
  72. ));
  73. }
  74.  
  75. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement