HomePage › Forums › Themes Support › Activland – Outdoor Activities WordPress Theme › How to change slugs
- This topic has 12 replies, 2 voices, and was last updated 1 year, 11 months ago by Billy Nguyen.
-
AuthorPosts
-
November 29, 2022 at 10:31 pm #29676mihSupport Expired
Hello,
how to change the slug for /accomodation/cotage and /whatwedo/activities?
I would like to translate accomodation and whatwedo + others.Thanks!
November 30, 2022 at 10:47 am #29687Hello,
Please send the admin web account for me, I will check and try to help you.
November 30, 2022 at 11:22 am #29693mihSupport ExpiredJust advise us here. The client doesn’t feel comfortable sending admin passwords to 3rd parties at the moment.
The question is pretty general though, maybe you don’t even need admin access.
Thank you!
November 30, 2022 at 2:28 pm #29701Ok, please follow the guide here:
#1. Change slug: copy this code and paste it to file functions.php ( child theme):
function activland_change_post_types_slug( $args, $post_type ) { /*item post type slug*/ if ( 'accommodation' === $post_type ) { $args['rewrite']['slug'] = 'your-slug'; }elseif('activland_activities' === $post_type){ $args['rewrite']['slug'] = 'your-slug'; }elseif('activland_whatwedo' === $post_type){ $args['rewrite']['slug'] = 'your-slug'; } return $args; } add_filter( 'register_post_type_args', 'activland_change_post_types_slug', 10, 2 );
#2. Translate:
Please install Loco translate plugin: https://wordpress.org/plugins/loco-translate/
and setup translate theme: https://localise.biz/wordpress/plugin/beginnersDecember 2, 2022 at 12:00 pm #29762mihSupport ExpiredHi,
thanks for the instructions. I have pasted the code from #1 to the functions.php of child theme.
I see some changes in links, but only in the first link on the site for each slug. Other links are not affected. Also, when the changed link is clicked, it returns 404 error. Other links (with original slugs) work properly.
Please help.
December 2, 2022 at 12:10 pm #29764mihSupport ExpiredSorry, it’s not true about the links not changing. I was looking at static links. Dynamic links all change according to expectations.
However, even if using the correct links or links from admin (for example Accomodation -> View) I always get a 404 error when opening a page.
P.S.: My WP is installed in a subfolder – if that might be a reason?
December 2, 2022 at 12:17 pm #29765mihSupport ExpiredAbout #2 translating slugs
I have installed Loco Translate and I can translate the texts found in the theme. However, I can’t find the texts for slugs. Where can I find them? What name are they stored under?December 2, 2022 at 4:38 pm #29769Not all customer guides can do it right, that’s why I asked for a customer account to look into and deal with the issue in person.
You see, it took me a while to write a tutorial for you, then you solved it and had a problem… now it’s time for me to review and support this problem for you!!
Please provide a web admin account so I can review and handle the issue for you.December 2, 2022 at 5:20 pm #29773mihSupport ExpiredWell, you can’t blame me if I follow your instructions and they don’t work.
Even if you fix the error, you will still have to tell what you did. Customer requires it.
December 2, 2022 at 5:24 pm #29774mihSupport ExpiredThis reply has been marked as private.December 3, 2022 at 8:59 am #29788This reply has been marked as private.December 3, 2022 at 6:43 pm #29803mihSupport ExpiredThank you, the slugs work now and don’t throw 404 error. What did you do to fix it?
Can you also please help with #2 – Translation of the slugs. I will setup the page in other languages and the slugs need to be also in other languages. I didn’t find this option in Loco Translate. Where can I set them up for each language?
December 5, 2022 at 8:46 am #29818This reply has been marked as private. -
AuthorPosts
You must be logged in to reply to this topic.