Homepage › Forum › Product Support › TruSmile › Service URL
- This topic has 11 replies, 2 voices, and was last updated 11 months, 1 week ago by
Jackie.
-
AuthorPosts
-
11 months, 2 weeks ago #28617
Dear team,
I need to change the URL services name. Where I can do it?
11 months, 2 weeks ago #28618images enclosed
Attachments:
You must be logged in to view attached files.11 months, 2 weeks ago #28627Hi.
This is the custom post type slug name, to change that name, you need to change the source code at file:
/wp-content/plugins/trusmile-framework/includes/posttypes/service.php line 51
/wp-content/plugins/trusmile-framework/includes/posttypes/doctor.php line 52
After changing that, please go to Settings/ Permalink and save the config again.
Thanks.
11 months, 2 weeks ago #28633Hi Jakie,
thanks for your feedback, I have updated the files and permalinks in settings (emptied the cache) but when I write the address
https://www.example.it/activities/test/ there is a redirect to >>> https://www.example.it/service/test/
can you write me all the lines where to change the code?
Thank you
11 months, 2 weeks ago #28654Hi.
Please give us your site URL, admin account. We will help you check that issue.
Thanks.
11 months, 2 weeks ago #28655Hi.
Please give us your site URL, admin account. We will help you check that issue.
Thanks.
11 months, 1 week ago #28682Hi.
To change the custom post type slug, please add the custom function at the end of this file: wp-content/themes/trusmile/functions.php
if( !function_exists('change_custom_post_type_slug') ): add_filter( 'register_post_type_args', 'change_custom_post_type_slug', 10, 2 ); function sc_change_custom_post_type_slug( $args, $post_type ) { if ( 'service' === $post_type ) { $args['rewrite']['slug'] = 'activities'; } return $args; } endif;
After adding the code, please go to Settings/ Permalinks and save the config.
That will help you change the slug as you want.
Thanks.
11 months, 1 week ago #28688A big thank you Jakie, now it works!
11 months, 1 week ago #28691Sorry Jakie, not resolved, now, when I try to save the function file, appears this error:
Your changes to the PHP code have been reverted due to an error on line 308 of the wp-includes/class-wp-hook.php file. Correct and try to save again.
Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, function "change_custom_post_type_slug" not found or invalid function name in wp-includes/class-wp-hook.php:308 Stack trace: #0 wp-includes/plugin.php(205): WP_Hook->apply_filters() #1 wp-includes/class-wp-post-type.php(442): apply_filters() #2 wp-includes/class-wp-post-type.php(418): WP_Post_Type->set_props() #3 wp-includes/post.php(1694): WP_Post_Type->__construct() #4 wp-includes/post.php(43): register_post_type() #5 wp-includes/class-wp-hook.php(308): create_initial_post_types() #6 wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters() #7 wp-includes/plugin.php(517): WP_Hook->do_action() #8 wp-settings.php(617): do_action() #9 wp-config.php(78): require_once('...') #10 wp-load.php(50): require_once('...') #11 wp-admin/admin.php(34): require_once('...') #12 wp-admin/theme-editor.php(10): require_once('...') #13 {main} thrown
11 months, 1 week ago #28701Sorry, Please try the custom code below:
if( !function_exists('change_custom_post_type_slug') ): add_filter( 'register_post_type_args', 'change_custom_post_type_slug', 10, 2 ); function change_custom_post_type_slug( $args, $post_type ) { if ( 'service' === $post_type ) { $args['rewrite']['slug'] = 'activities'; } return $args; } endif;
Thanks.
11 months, 1 week ago #28704Dear Jackie,
the url about activities is now ok, resolved, i tried to apply the same rule for doctors but its not working
for example, I want to change from https://www.example.it/doctor/test/ to >>>
https://www.example.it/engineer/test/
Thanks once again for your support.
11 months, 1 week ago #28716Hi.
For the doctor custom post type, please add the custom source code below:
if( !function_exists('change_custom_post_type_slug_2') ): add_filter( 'register_post_type_args', 'change_custom_post_type_slug_2', 10, 2 ); function change_custom_post_type_slug_2( $args, $post_type ) { if ( 'doctor' === $post_type ) { $args['rewrite']['slug'] = 'engineer'; } return $args; } endif;
Thanks.
-
AuthorPosts
You must be logged in and have valid license to reply to this topic.