ResolvedChanging porfolio Slug
- This topic has 3 replies, 3 voices, and was last updated 2 years, 4 months ago by
Floppy78.
Viewing 4 posts - 1 through 4 (of 4 total)
- AuthorPosts
- November 19, 2020 at 2:05 pm #27284
Floppy78
ParticipantHi again, I’ve another issue to ask for. I’d like to change “portfolio” slug to “collections”. I know I should use functions.php in my child theme to redefine grosso_portfolio custom post tipe details but I’ll prefer to have some hints not to make mistakes. Thank a lot!
November 24, 2020 at 2:18 pm #27375Althemist
KeymasterHello Flora,
our lead developer Alex will step in to give you instructions.
Regards,
DimitarNovember 24, 2020 at 4:55 pm #27393Alex
KeymasterHello Flora,
Here is the exact code to put in your functions.php file in the child theme. I’ve modified all the labels from “portfolio” to “collection”, but double-check if they are what you want.
remove_action('init', 'grosso_register_cpt_grosso_portfolio', 5); add_action('init', 'grosso_child_register_cpt_grosso_portfolio', 5); function grosso_child_register_cpt_grosso_portfolio() { $labels = array( 'name' => esc_html__('Collections', 'grosso-plugin'), 'singular_name' => esc_html__('Collection', 'grosso-plugin'), 'add_new' => esc_html__('Add New', 'grosso-plugin'), 'add_new_item' => esc_html__('Add New Collection', 'grosso-plugin'), 'edit_item' => esc_html__('Edit Collection', 'grosso-plugin'), 'new_item' => esc_html__('New Collection', 'grosso-plugin'), 'view_item' => esc_html__('View Collection', 'grosso-plugin'), 'search_items' => esc_html__('Search Collection', 'grosso-plugin'), 'not_found' => esc_html__('No Collections found', 'grosso-plugin'), 'not_found_in_trash' => esc_html__('No collection found in Trash', 'grosso-plugin'), 'parent_item_colon' => esc_html__('Parent Collection:', 'grosso-plugin'), 'menu_name' => esc_html__('Collections', 'grosso-plugin'), ); $args = array( 'labels' => $labels, 'hierarchical' => false, 'description' => 'Grosso portfolio post type', 'supports' => array('title', 'editor', 'excerpt', 'author', 'thumbnail', 'trackbacks', 'revisions', 'page-attributes'), 'taxonomies' => array('grosso_portfolio_category'), 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'publicly_queryable' => true, 'exclude_from_search' => false, 'has_archive' => true, 'query_var' => true, 'can_export' => true, 'rewrite' => true, 'capability_type' => 'page', 'menu_icon' => 'dashicons-portfolio', 'rewrite' => array( 'slug' => esc_html__('collection', 'grosso-plugin') ) ); register_post_type('grosso-portfolio', $args); }
Regards,
AlexNovember 30, 2020 at 10:54 am #27503Floppy78
ParticipantThanks a lol for your help! It works perfectly! 🙂
Have a good day!Flora
- AuthorPosts
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in and have valid license to reply to this topic.