Issue with 9.7 update changes, "single_template_*" in child theme

Posted in: Newspaper
Post count: 39

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

Post count: 20688

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

Post count: 39

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?

Post count: 39

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.

Post count: 20688

Thank you for mentioning it. I will make a note of it and pass it along to the developer team. They will check it and make the necessary modifications if needed.

Post count: 39

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.

Post count: 1

Thanks for this workaround. This would be great to have in the plugin. Just tested it on my installation.

Post count: 39

@uscho

Glad to hear that it was useful for someone!

I posted the piece of code on my blog

http://webdevsguide.com/blog/allow-child-theme-templates-in-tagdiv-newspaper-theme-after-9-7-version/

Post count: 19

I’m not seeing the td_api.php in my wp-booster folder?

Post count: 39

@altpress

Yes, it’s been moved to the td-composer plugin in the 9.7.3 release

Viewing 10 posts - 1 through 10 (of 10 total)
The forum ‘Newspaper’ is closed to new topics and replies.