Support

Home Forums Event Espresso Premium Translated slug to single category not working

Translated slug to single category not working

Posted: April 15, 2015 at 2:19 am


Sabine

April 15, 2015 at 2:19 am

In this thread I described my problems with links to a single event category page. Finally I got it working when I set the site language to English but that was only for testing purposes. When I switched back to Dutch, the links gave 404’s again. I see that the ‘event-category’-part of the URL is also translated which is a good thing but under the hood it’s obviously not recognized.

The working url if the site language is set to English is

http://www.example.nl/event-category/categoryname/

when switched to Dutch the NOT working url is

http://www.example.nl/categorieevenement/categoryname/

Yes, I refreshed the Permalinks after switching languages.

I downloaded the latest translations files from GitHub and put the Dutch .po en .mo files both in the languages directory of the plugin and in the wp-content/languages/plugins dir. I don’t use a translation plugin because the website is only in Dutch.

Anyone an idea how to solve this?


Dean

April 15, 2015 at 2:38 am

Hi,

I think the issue is that the translation and the Custom Post Type slug are at odds with each other.

One way to resolve it would be to change the CPT slug for the Event Categories to the actual translated slug.

Add this function to a site specific plugin:

add_filter( 'FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', 'my_custom_event_category_slug');
	function my_custom_event_category_slug( $thearray ) {

    	if ( !empty($thearray['espresso_event_categories']) ) {
    		$thearray['espresso_event_categories']['args']['rewrite']['slug'] = 'categorieevenement';
    		return $thearray;
    	}
    	return $thearray;
    }

Remember to “flush” your permalinks afterwards by going to Settings > Permalinks > and pressing save.


Sabine

April 15, 2015 at 3:12 am

Dean, you are a real genius, finally everything is working in Dutch! Thank you so much.

The support post ‘Translated slug to single category not working’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso