1. Rename Project Post Type
// RENAME DIVI PROJECTS CUSTOM POST TYPE function ze_rename_projects_cpt() { register_post_type( 'project', array( 'labels' => array( 'name' => __( 'Portfolio', 'divi' ), // CHANGE SPECIALS TO WHATEVER YOU WANT 'singular_name' => __( 'Portfolio', 'divi' ), // CHANGE SPECIAL TO WHATEVER YOU WANT ), 'has_archive' => true, 'hierarchical' => true, 'public' => true, 'rewrite' => array( 'slug' => 'portfolio', 'with_front' => false ), // CHANGE SPECIAL TO WHAT YOU WANT YOUR SLUG TO BE 'menu_icon' => 'dashicons-tag', // CHANGE TO AN ICON TO MATCH YOUR NEW POST TYPE 'supports' => array(), )); } add_action( 'init', 'ze_rename_projects_cpt' );
2. Rename DIVI Category Name
add_filter('register_taxonomy_args', 'activity_register_taxonomy_args', 10, 3); function activity_register_taxonomy_args($args, $taxonomy, $object_type){ // The labels we are going to use $new_singular_name = "Activity Type"; $new_plural_name = "Activity Types"; // If it's either the project_category taxonomy, we apply the new name if ('project_category' == $taxonomy) { $args['labels']['name'] = $new_plural_name; $args['labels']['singular_name'] = $new_singular_name; $args['labels']['menu_name'] = $new_plural_name; } // Or if it's the project_tag taxonomy, we apply the new name if ('project_tag' == $taxonomy) { $args['labels']['name'] = $new_plural_name . ' Tags'; $args['labels']['singular_name'] = $new_singular_name . ' Tag'; } // Finally return the taxonomy_args return $args; }
3. Add Multiple Category DIVI Project
function wpdocs_create_activity_taxonomies() { // Add new taxonomy, make it hierarchical (like categories) $labels = array( 'name' => _x( 'Age', 'taxonomy general name', 'textdomain' ), 'singular_name' => _x( 'Age', 'taxonomy singular name', 'textdomain' ), 'search_items' => __( 'Search Age', 'textdomain' ), 'all_items' => __( 'All Age', 'textdomain' ), 'parent_item' => __( 'Parent Age', 'textdomain' ), 'parent_item_colon' => __( 'Parent Age:', 'textdomain' ), 'edit_item' => __( 'Edit Age', 'textdomain' ), 'update_item' => __( 'Update Age', 'textdomain' ), 'add_new_item' => __( 'Add New Age', 'textdomain' ), 'new_item_name' => __( 'New Genre Age', 'textdomain' ), 'menu_name' => __( 'Age', 'textdomain' ), ); $args = array( 'hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'show_admin_column' => true, 'query_var' => true, 'rewrite' => array( 'slug' => 'age' ), ); register_taxonomy( 'age', array( 'project' ), $args ); unset( $args ); unset( $labels ); // Add new taxonomy, NOT hierarchical (like tags) $labels = array( 'name' => _x( 'Week Day', 'taxonomy general name', 'textdomain' ), 'singular_name' => _x( 'Week Day', 'taxonomy singular name', 'textdomain' ), 'search_items' => __( 'Search Week Day', 'textdomain' ), 'popular_items' => __( 'Popular Week Day', 'textdomain' ), 'all_items' => __( 'All Week Day', 'textdomain' ), 'parent_item' => null, 'parent_item_colon' => null, 'edit_item' => __( 'Edit Week Day', 'textdomain' ), 'update_item' => __( 'Update Week Day', 'textdomain' ), 'add_new_item' => __( 'Add New Week Day', 'textdomain' ), 'new_item_name' => __( 'New WWeek Day', 'textdomain' ), 'separate_items_with_commas' => __( 'Separate Week Day with commas', 'textdomain' ), 'add_or_remove_items' => __( 'Add or remove Week Day', 'textdomain' ), 'choose_from_most_used' => __( 'Choose from the most used Week Day', 'textdomain' ), 'not_found' => __( 'No Week Day found.', 'textdomain' ), 'menu_name' => __( 'Week Day', 'textdomain' ), ); $args = array( 'hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'show_admin_column' => true, //'update_count_callback' => '_update_post_term_count', 'query_var' => true, 'rewrite' => array( 'slug' => 'weekday' ), ); register_taxonomy( 'weekday', 'project', $args ); unset( $args ); unset( $labels ); // Add new taxonomy, NOT hierarchical (like tags) $labels = array( 'name' => _x( 'Location', 'taxonomy general name', 'textdomain' ), 'singular_name' => _x( 'Location', 'taxonomy singular name', 'textdomain' ), 'search_items' => __( 'Search Location', 'textdomain' ), 'popular_items' => __( 'Popular Location', 'textdomain' ), 'all_items' => __( 'All Location', 'textdomain' ), 'parent_item' => null, 'parent_item_colon' => null, 'edit_item' => __( 'Edit Location', 'textdomain' ), 'update_item' => __( 'Update Location', 'textdomain' ), 'add_new_item' => __( 'Add Location', 'textdomain' ), 'separate_items_with_commas' => __( 'Separate Location with commas', 'textdomain' ), 'add_or_remove_items' => __( 'Add or remove Location', 'textdomain' ), 'choose_from_most_used' => __( 'Choose from the most used Location', 'textdomain' ), 'not_found' => __( 'No Location found.', 'textdomain' ), 'menu_name' => __( 'Location', 'textdomain' ), ); $args = array( 'hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'show_admin_column' => true, //'update_count_callback' => '_update_post_term_count', 'query_var' => true, 'rewrite' => array( 'slug' => 'activity-location' ), ); register_taxonomy( 'activity-location', 'project', $args ); } // hook into the init action and call create_book_taxonomies when it fires add_action( 'init', 'wpdocs_create_activity_taxonomies', 0 );
Jagdish Sarma Asked question October 21, 2021