Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Modifies Projects post type to be Services
<?php
add_filter( 'projects_post_type_rewrite', 'change_projects_nomenclature_rewrite' );
add_filter( 'projects_post_type_labels', 'change_projects_nomenclature_labels' );
add_filter( 'projects_post_type_singular_name', 'change_projects_nomenclature_singular_name' );
add_filter( 'projects_post_type_plural_name', 'change_projects_nomenclature_plural_name' );
add_filter( 'projects_post_type_designation', 'change_projects_nomenclature_designation' );
function change_projects_nomenclature_rewrite() {
return array( 'slug' => 'service', 'with_front' => true );
}
function change_projects_nomenclature_singular_name() {
return 'Service';
}
function change_projects_nomenclature_plural_name() {
return 'Services';
}
function change_projects_nomenclature_designation() {
return 'service';
}
function change_projects_nomenclature_labels( $labels ) {
$singular_name = 'Service';
$plural_name = 'Services';
$post_type = 'service';
$labels = array(
'name' => $plural_name,
'singular_name' => $singular_name,
'add_new' => _x( 'Add New', $post_type, 'projects-by-woothemes' ),
'add_new_item' => sprintf( __( 'Add New %s', 'projects-by-woothemes' ), $singular_name ),
'edit_item' => sprintf( __( 'Edit %s', 'projects-by-woothemes' ), $singular_name ),
'new_item' => sprintf( __( 'New %s', 'projects-by-woothemes' ), $singular_name ),
'all_items' => sprintf( _x( 'All %s', $post_type, 'projects-by-woothemes' ), $plural_name ),
'view_item' => sprintf( __( 'View %s', 'projects-by-woothemes' ), $singular_name ),
'search_items' => sprintf( __( 'Search %a', 'projects-by-woothemes' ), $plural_name ),
'not_found' => sprintf( __( 'No %s Found', 'projects-by-woothemes' ), $plural_name ),
'not_found_in_trash' => sprintf( __( 'No %s Found In Trash', 'projects-by-woothemes' ), $plural_name ),
'parent_item_colon' => '',
'menu_name' => $plural_name
);
return $labels;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.