Programming, WordPress

WPML custom post type slug translation

If you are struggling to translate the slugs for custom post type then, read this article and try to implement the solution in your website.

Suppose, we have custom post type ‘programs‘ and we want to update its slug for each available languages.

I would like to recommend the following steps for translating the custom post type slugs in different languages :

  1. Go to WPML -> String Translation
  2. From the String Translation admin screen search for the English slug “programs”, select the available strings and delete it. Similarly, from the String Translation admin screen search for the slug “programas” and delete it. In short, delete any string translation for related custom slugs.
  3. Go to WPML-> Translation Management-> Multilingual Content Setup and in the Custom posts slug translation options, check the box to “Translate custom posts slugs (via WPML String Translation).” and click Save.
  4. Then, scroll down to custom post types, where you can see the lists for posts ready to to be translated. Select the post to be translated and Save it. Once the page refreshes, you can see the original posts slug  and fields where you can enter the slugs for each of your secondary languages. Save the translated custom post slugs.
  5. Check the posts links for each language.Finally, you can see the fine links with the translated slug for each language.

Hits: 32

Standard
Programming

Language specific post count

If you are using WPML and you want  to  count current language posts, you can use the following code :

Don’t Forget to add  ‘suppress_filters’ => false parameter  in your query.

If you want to display total posts count, irrespective of the languages; then  use  ‘suppress_filters’ =>true parameter in your  query.

Hits: 10

Standard