Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Manually Creating Custom Taxonomies
- ===========================
- //hook into the init action and call create_book_taxonomies when it fires
- add_action( 'init', 'create_topics_hierarchical_taxonomy', 0 );
- //create a custom taxonomy name it topics for your posts
- function create_topics_hierarchical_taxonomy() {
- // Add new taxonomy, make it hierarchical like categories
- //first do the translations part for GUI
- $labels = array(
- 'name' => _x( 'Penerbit', 'taxonomy general name' ),
- 'singular_name' => _x( 'Penerbit', 'taxonomy singular name' ),
- 'search_items' => __( 'Search Penerbit' ),
- 'all_items' => __( 'All Penerbit' ),
- 'parent_item' => __( 'Parent Penerbit' ),
- 'parent_item_colon' => __( 'Parent Penerbit:' ),
- 'edit_item' => __( 'Edit Penerbit' ),
- 'update_item' => __( 'Update Penerbit' ),
- 'add_new_item' => __( 'Add New Penerbit' ),
- 'new_item_name' => __( 'New Penerbit Name' ),
- 'menu_name' => __( 'Penerbit' ),
- );
- // Now register the taxonomy
- register_taxonomy('penerbit',array('post'), array(
- 'hierarchical' => true,
- 'labels' => $labels,
- 'show_ui' => true,
- 'show_admin_column' => true,
- 'query_var' => true,
- 'rewrite' => array( 'slug' => 'penerbit' ),
- ));
- }
- Kode menampilkan di web, masukkan ke single.php:
- <?php the_terms( $post->ID, 'penerbit', 'Penerbit: ', ', ', ' ' ); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement