Hello,
The templates I copied from the old Newspaper theme(before 9.7) to a custom child theme no longer work, as the original templates have been moved to the td-composer plugin.
You have an old guide here on how to do exactly this, but its no longer relevant as all the templates have been moved to the td-composer plugin.
Can you help me with making this work?
Thanks
Hi,
That is correct, the post template files are now in the composer plugin. They can only be modified there – http://prntscr.com/o1878j in a child theme it isn’t possible anymore. If we should find a safer or update proof way to modify the files from the plugin, we will provide it and create documentation for it.
The child theme functionality is very limited after the recent theme updates, and the guide will be modified as soon as possible.
Thanks
Hi Simion,
Thanks for the reply, yes I see where they are located, could you include a special folder in the child theme to override these templates in the near future?
OK found a way by overriding your core templating engine.
I found a bug in the 9.7 version of the Newspaper theme in the “td_api.php” file:
on line: 365 -> and (stripos($the_component[‘file’], td_global::$get_template_directory) == 0)
you are checking if a stripos of a file path is == 0, which means you are testing if the string position is at 0 or it is actually “false” / if the file is inside the theme or if it’s not inside the theme, which makes the condition useless – its true in either case.
should be: !== false
Feels like this is not intended behavior.
OK cool,
BTW.
This is what I did to enable overriding the single templates in the child theme:
td_api.php file line 365, added the following code:
if((stripos($the_component['file'], td_global::$get_template_directory) !== false)) {
$child_path = get_stylesheet_directory() . str_replace(td_global::$get_template_directory, '', $the_component['file']);
$the_component['located_in_child'] = true;
}
elseif((stripos($the_component['file'], TDC_PATH) !== false)) {
$child_path = get_stylesheet_directory() . str_replace(TDC_PATH, '', $the_component['file']);
$the_component['located_in_child'] = true;
}
if (isset($child_path) && file_exists($child_path)) {
$the_component['file'] = $child_path;
}
Hope you can integrate something like that in the near future.
Glad to hear that it was useful for someone!
I posted the piece of code on my blog
Yes, it’s been moved to the td-composer plugin in the 9.7.3 release