WPML and custom post types archive template WPML and custom post types archive template wordpress wordpress

WPML and custom post types archive template


I found this support thread where they say that one should change the following line (in your code):

'has_archive' => 'case-studies',

to:

'has_archive' => icl_translate('wpml_custom', 'wpml_custom_showcases', 'case-studies'),

Might be a good idea to ask the official support for this, as it's commercial software and no documentation is available.


I found out what was the problem.

The string was not translated under WPML -> String translations

When I translated it (case-studies -> de/case-studies) it worked.

Actually, it worked in all variants - both my original code, and code suggested in the answers.


I think this will work for you, just missing some action :)

'has_archive' => 'case-studies',

to

'has_archive' => icl_translate('wpml_custom', 'wpml_custom_showcases', 'case-studies'),

THEN

Go to Settings > Permalinks and hit 'Save'.

Let me know if this works perfectly.

Cheers!