Change URL for services

Hi.

As default, all the services will have the URL www.doffe.no/services on my page, but I’d like to change “services” to something else. Is this possible?

Hello there,

It can be accomplished by adding the below function into your child theme’s functions.php file.


add_filter('sydney_services_rewrite_slug', 'sydney_child_services_slug');
function sydney_child_services_slug() {
  return 'our-services';
}

If you don’t want to use a child theme, alternatively you can use the functionality plugin like Code Snippets.

Once you’re done, you have flush your site’s permalink structure by visiting Settings > Permalinks, and just hit the save changes button.

Regards,
Kharis

Hi.

After testing this, I got some problems.

In the editor, I saw that the “services” part of the URL was changed into the new “folder” I wanted for the services. But, when trying to view the article, I got 404 error. The new URL was not valid. But, when entering the “old” URL into the browser, I could see the article.

This code was to replace www.doffe.no/services with www.doffe.no/our-services, right? In my case, I replaced our-services with a different word, but…

Removed the code now, to get the page up and running, while trying to figure this one out… :slight_smile:

Have flush your site’s permalink structure as I mentioned in the last instruction?

Once you’re done, you have flush your site’s permalink structure by visiting Settings > Permalinks, and just hit the save changes button.

Regards,
Kharis

Hehe… Forgot to flush… :wink:

So, now it’s working. Thanks a lot! :slight_smile:

You’re welcome!

Please let us know in a new topic if you have any further questions, or if we can provide you with any other assistance.

Regards,
Kharis

Short follow-up on this one; can this also be done for employees, testimonials and clients, as well?

And, does this change the URL structure, or does it only make a route/forwarding? When I see our page on google, it seems like the “old” URLs are still alive…

Hello Doffe,

The Sydney toolbox comes with some hooks that allows us to change the default permalink slug. For other post types, use this PHP code:


/**
 * Change clients permalink slug
 */
add_filter('sydney_clients_rewrite_slug', 'sydney_child_clients_slug');
function sydney_child_clients_slug() {
  return 'our-clients';
}

/**
 * Change employees permalink slug
 */
add_filter('sydney_employees_rewrite_slug', 'sydney_child_employees_slug');
function sydney_child_employees_slug() {
  return 'our-employees';
}

/**
 * Change testimonials permalink slug 
 */
add_filter('sydney_testimonials_rewrite_slug', 'sydney_child_testimonials_slug');
function sydney_child_testimonials_slug() {
  return 'fine-testimonials';
}

It does really change the permalink slug permanently. However the older one might still be saved in the database. To remove it, you can use this plugin.

Regards,
Kharis

Is there a way I can remove ‘employees’ from my employee pages with a CSS code? Please see below for reference:

Hello there,

It looks like you’ve already replaced it with yourstory slug. Please let us know if still need an assistance.

Regards,
Kharis

All fixed, thank you so much guys!

You’re welcome!

Please let us know in a new topic if you have any further questions, or if we can provide you with any other assistance.

Regards,
Kharis