Polylang and template files

I divided the website i am making in diferent template files for example: Category for blog -> category-blog.php Category for projects -> category-projects.php But now I am using the POLYLANG plug in to make the translations. I've noticed that while i am creating the respective category in other languages the template does not apply for example category-blog.php file does not apply to the category-blog.php in other languages. Is any way that i can use the same category template file to multiple categories?? more specifically to the translations of the same category ?

Sorry if my questions seems confusing !

Thanks in advance !

Topic plugin-polylang php categories templates Wordpress

Category Web


One option is to create a single category.php file with conditionals. So, you would have something like this:

<?php
if(is_category('one') || is_category('un') {
// your code here
} elseif(is_category('two') || is_category('deux') {
// your code here
}
?>

This way you can still output different code per category, but you won't have to copy category-one.php to category-un.php etc.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.