Skip to content

Instantly share code, notes, and snippets.

@jamieschmid
Last active December 14, 2015 20:04
Show Gist options
  • Save jamieschmid/c83d3c39316ace7a88b7 to your computer and use it in GitHub Desktop.
Save jamieschmid/c83d3c39316ace7a88b7 to your computer and use it in GitHub Desktop.
Change Projects Custom Post Type name in Divi, still works with Portfolio
$singular_name = 'Book'; // Enter the singular name for your new post type within the quotes
$plural_name = 'Books'; // Enter the plural name of your new post type within the quotes
function divi_projects_rename() {
global $wp_post_types;
global $singular_name;
global $plural_name;
$labels = $wp_post_types['project']->labels;
$labels->menu_name = __( $plural_name, 'Divi' );
$labels->name = __( $plural_name, 'Divi' );
$labels->singular_name = __( $singular_name, 'Divi' );
$labels->add_new = __( 'Add New', 'Divi' );
$labels->add_new_item = __( 'Add New '.$singular_name, 'Divi' );
$labels->edit_item = __( 'Edit '.$singular_name, 'Divi' );
$labels->new_item = __( 'New '.$singular_name, 'Divi' );
$labels->all_items = __( 'All '.$plural_name, 'Divi' );
$labels->view_item = __( 'View '.$plural_name, 'Divi' );
$labels->search_items = __( 'Search '.$plural_name, 'Divi' );
}
function divi_projects_slug_rename() {
global $plural_name;
$slug_name = strtolower($plural_name);
return array(
'feeds' => true,
'slug' => $slug_name,
'with_front' => false,
);
}
add_filter( 'et_project_posttype_rewrite_args', 'divi_projects_slug_rename' );
@davedenis
Copy link

Question: where do you call divi_projects_rename()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment