Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_action( 'init', 'tdd_create_custom_post_type' );
- function tdd_create_custom_post_type() {
- $labels = array( 'name' => _x( 'solicitors', 'post type general name' ),
- 'singular_name' => _x( 'solicitor', 'post type singular name' ),
- 'add_new' => _x( 'New solicitor', 'add new singular name' ),
- 'add_new_item' => __( 'Add New solicitor' ),
- 'edit_item' => __( 'Edit solicitor' ),
- 'new_item' => __( 'New solicitor' ),
- 'view_item' => __( 'View solicitor' ),
- 'search_items' => __( 'Search solicitors' ),
- 'not_found' => __( 'No solicitors Found' ),
- 'not_found_in_trash' => __( 'No solicitors found in Trash' ),
- );
- $args = array( 'labels' => $labels,
- 'public' => true,
- 'publicly_queryable' => true,
- 'show_ui' => true,
- 'query_var' => true,
- 'rewrite' => true,
- 'has_archive' => 'solicitors',
- 'capability_type' => 'post',
- 'hierarchical' => true,
- 'show_in_nav_menus' => true,
- 'menu_position' => 100, // last block
- 'supports' => array( 'title', 'editor', 'revisions', 'shortlink' )
- );
- register_post_type( 'solicitor', $args );
- $tax_labels = array(
- 'name' => _x( 'Specialities', 'taxonomy general name' ), // there will only be one
- 'singular_name' => _x( 'Speciality', 'taxonomy singular name' ),
- 'search_items' => __( 'Search specialities' ),
- 'popular_items' => __( 'Popular specialities' ),
- 'all_items' => __( 'All specialities' ),
- 'parent_item' => null,
- 'parent_item_colon' => null,
- 'edit_item' => __( 'Edit speciality' ),
- 'update_item' => __( 'Update speciality' ),
- 'add_new_item' => __( 'Add New speciality' ),
- 'new_item_name' => __( 'New speciality Name' ),
- 'separate_items_with_commas' => __( 'Separate specialities with commas' ),
- 'add_or_remove_items' => __( 'Add or remove specialities' ),
- 'choose_from_most_used' => __( 'Choose from the most used specialities' )
- );
- $tax_args = array(
- 'labels' => $tax_labels,
- 'hierarchical' => false,
- 'show_ui' => true,
- 'query_var' => true,
- 'rewrite' => array( 'slug' => 'solicitor-speciality' ),
- )
- register_taxonomy( 'speciality', 'solicitor', $tax_args );
- }
- add_filter( 'the_content', 'tdd_extra_content' );
- function tdd_extra_content( $content ) {
- global $post;
- if ( isset( $post->post_type ) && ( 'solicitor' == $post->post_type ) )
- return $content . get_the_term_list( $post->ID, 'speciality', 'Specialities: ', ', ' , '' );
- return $content;
- } //end extra_content
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement