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 !
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 !
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.
category-projects.php
, the stringprojects
is the slug for the category in one language. then if you have the categoryprojects_spanish
, you can create the filecategory-projects_spanish.php
and put inside<?php require "category-projects.php";
– Kaperto Commented Dec 20, 2019 at 10:15