John Davidson

php - Wordpress same custom post template for different languages

0 comments
Message:


I have a Wordpress webpage where a former web developer created a custom post type using Pods pulgin, on this custom post type there is a post that we can call "Ejemplo", that post uses content-single-ejemplo.php to be build but the english version "Example" is being created with content-single.php.


What should I do to use the same content-single-example.php for the same post on both languages instead of content-single.php for the english version?
(We are using the plugin WPML for translations)


I've already tried cloning the content-single-ejemplo.php and rename it as content-single-example.php but it still doesn't work.



My Answer:
To use the same custom post template for different languages in WordPress with WPML, you can follow these steps:

1. Make sure you have the WPML plugin installed and activated on your WordPress site.

2. Go to WPML -> Theme and Plugin Localization and make sure that your theme is set to "Translate using WPML's String Translation" option.

3. In your theme folder, locate the file content-single-ejemplo.php and duplicate it. Rename the duplicated file to content-single-example.php.

4. Open the content-single-example.php file and replace all instances of "Ejemplo" with "Example" in the file.

5. In your WordPress admin panel, go to WPML -> String Translation. Search for the strings "Ejemplo" and "Example" and make sure they are translated correctly.

6. Now, when you create a new post in the "Ejemplo" custom post type and translate it to English using WPML, it should use the content-single-example.php template file for the English version.

By following these steps, you should be able to use the same custom post template for different languages in WordPress with WPML.

Rate this post

3 of 5 based on 6876 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us