I have a static website in html which is multilanguage. So, I have created several subdirectories depending on the language is selected, this is, "lang" folder for the languages and "fr" folder for francais and "es" for spanish. However, I don't know how to call my template page in WordPress from the control panel for those pages are in another folder.
I have evaluated the issue and I know that is an option available from 3.4 version and you have to create a page-templates folder in the root of your theme, but in my case I'm able only to see my template pages which are in the root of my theme, not from the subdirectory.
Now my directory system is:
wp-content -> themes -> myTheme -> [page-templates folder] - index.php / style.css -> [lang folder] -> [es folder] - about_me.php
Any help would be much appreciated.
OK. It seems to me that you have a couple of options.
A better way of doing this would be to use the translating options that wordpress already provide.
To learn more about them you should read at least:
You can easily create your own language file in php and write language translations to an array to translate your site.
Example:
File 1 - Language-EN.php
$language_array = array(
"hello" => "hello",
"world" => "world"
);
File 2 - Language-NL.php
$language_array = array(
"hello" => "hallo",
"world" => "wereld"
);
File 3 - Page-Template.php
$language = "nl";
if($language = "nl")
{
include 'language-nl.php';
}
elseif ($language = "en")
{
include 'language-en.php';
}
echo $language["hello"];
or (if you are sure the $language variable is set correctly)
$language = "nl";
include "language-{$language}.php";
echo $language["hello"];
Example:
Create a page template in your themes root directory
File : page-custom.php
<?php
/*
Template Name: My Custom Page
*/
include get_template_directory() . "/subdirectory/subpage-custom.php";
Then create a new file in your subdirectory
File: theme-root/subdirectory/subpage-custom.php
<?php echo "Your code goes here"; ?>
Now you can select your page template from the post editor (under attributes)
WordPress only searches for templates in the theme directory and one level below. To do what you want, you'd need to adapt to this. For example:
/themes/myTheme
/templates-en
/templates-es
...