@MvdO79
There are few major issues with child theme.
It is not "issue" as "issue", but I think this is not way you would prefer for child themes.
The core issue is, that i.e. if you want to replace footer, you must do it in all files.
What does it means? If you create footer.php and main.php, update footer in child theme and will be OK on home page.
But, when you go to item page, old footer is used.
Why so? Because you have not replaced item.php in child theme, this means item.php of parent theme is used and this one includes footer from parent theme.
I am planning to spend some time to investigate, if this could be changed in:
<?php osc_current_web_theme_path('some-file') ; ?>
<?php osc_current_web_theme_url('some-file') ; ?>
Right now path depends on file that calls it, I would prefer check in case you use child theme.
Right now, these function are created in hDefines.php and looks like this:
/**
* Gets the complete url of a given file using the theme url as a root
*
* @param string $file the given file
* @return string
*/
function osc_current_web_theme_url($file = '') {
$info = WebThemes::newInstance()->loadThemeInfo(WebThemes::newInstance()->getCurrentTheme());
if (!file_exists(WebThemes::newInstance()->getCurrentThemePath() . $file) && isset($info['template']) && $info['template'] != ''){
WebThemes::newInstance()->setParentTheme();
}
return WebThemes::newInstance()->getCurrentThemeUrl() . $file;
}
/**
* Gets the complete path of a given file using the theme path as a root
*
* @param string $file
* @return string
*/
function osc_current_web_theme_path($file = '') {
$info = WebThemes::newInstance()->loadThemeInfo(WebThemes::newInstance()->getCurrentTheme());
if( file_exists(WebThemes::newInstance()->getCurrentThemePath() . $file) ){
require WebThemes::newInstance()->getCurrentThemePath() . $file;
} elseif($info['template'] != '') {
WebThemes::newInstance()->setParentTheme();
if( file_exists(WebThemes::newInstance()->getCurrentThemePath() . $file) ) {
require WebThemes::newInstance()->getCurrentThemePath() . $file;
} else {
WebThemes::newInstance()->setGuiTheme();
if( file_exists(WebThemes::newInstance()->getCurrentThemePath() . $file) ) {
require WebThemes::newInstance()->getCurrentThemePath() . $file;
}
}
} else {
WebThemes::newInstance()->setGuiTheme();
if( file_exists(WebThemes::newInstance()->getCurrentThemePath() . $file) ) {
require WebThemes::newInstance()->getCurrentThemePath() . $file;
}
}
}
That is problem, because if file exists, it does not look for anything else. Child theme conditions are like "just in case".
I've played with it for more than 2 hours and here is new version of files (modified for osclass 4.4) that will always check child/parent theme files no matter if you have child theme or parent theme activated. Will be updated and fixed in 4.5, but for easy of testing and use, try to replace with following functions:
/**
* Gets the complete url of a given file using the theme url as a root
*
* @param string $file the given file
* @return string
*/
function osc_current_web_theme_url($file = '') {
$theme = WebThemes::newInstance()->getCurrentTheme();
$file_fix = explode('?', $file)[0]; // remove version from file, i.e. style.css?v=21311
$theme_split = explode('_', $theme);
// HANDLE CHILD THEME IN BEST POSSIBLE WAY (v450)
if(1==1) {
if(isset($theme_split[1]) && $theme_split[1] == 'child') {
$theme_child = $theme;
$theme = $theme_split[0];
} else {
$theme_child = $theme . '_child';
$theme = $theme;
}
WebThemes::newInstance()->setCurrentTheme($theme_child);
if(file_exists(WebThemes::newInstance()->getCurrentThemePath() . $file_fix)){
return WebThemes::newInstance()->getCurrentThemeUrl() . $file;
}
WebThemes::newInstance()->setCurrentTheme($theme);
if(file_exists(WebThemes::newInstance()->getCurrentThemePath() . $file_fix)) {
return WebThemes::newInstance()->getCurrentThemeUrl() . $file;
}
}
}
/**
* Gets the complete path of a given file using the theme path as a root
*
* @param string $file
* @return string
*/
function osc_current_web_theme_path($file = '') {
$theme = WebThemes::newInstance()->getCurrentTheme();
$theme_split = explode('_', $theme);
if(1==1) {
if(isset($theme_split[1]) && $theme_split[1] == 'child') {
$theme_child = $theme;
$theme = $theme_split[0];
} else {
$theme_child = $theme . '_child';
$theme = $theme;
}
WebThemes::newInstance()->setCurrentTheme($theme_child);
if(file_exists(WebThemes::newInstance()->getCurrentThemePath() . $file)){
require WebThemes::newInstance()->getCurrentThemePath() . $file;
return;
}
WebThemes::newInstance()->setCurrentTheme($theme);
if(file_exists(WebThemes::newInstance()->getCurrentThemePath() . $file)) {
require WebThemes::newInstance()->getCurrentThemePath() . $file;
return;
}
WebThemes::newInstance()->setGuiTheme();
if(file_exists(WebThemes::newInstance()->getCurrentThemePath() . $file)) {
require WebThemes::newInstance()->getCurrentThemePath() . $file;
}
}
}
For me it worked better I was expecting.