-
-
Save davedenis/56a95f6923ec78064d12 to your computer and use it in GitHub Desktop.
Change Projects Custom Post Type name in Divi, still works with Portfolio
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment