Skip to content

Instantly share code, notes, and snippets.

@jeffikus
Created December 1, 2015 13:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffikus/e3cf8858adaf3f77c97b to your computer and use it in GitHub Desktop.
Save jeffikus/e3cf8858adaf3f77c97b to your computer and use it in GitHub Desktop.
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