TagDiv Newspaper 9.7 Theme Update – Child theme Templates Fix

After the Newspaper tagdiv theme was updated to 9.7, the support that it had for extending and overriding the post templates from the child theme had been removed and all the template functionality moved to the td-composer plugin.

To keep the support that existed for child themes, like overriding the Newspaper parent theme templates, this is the code that I had to add to one of the Newspaper core classes.

Newspaper/includes/wp_booster/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;
}

Newspaper 9.7.3 Update

In this updated version, the td_api.php file has been moved together with other core files to the td-composer plugin, so the code above has to be added inside the td-composer plugin.

The new td_api.php file location is:

wp-content\plugins\td-composer\legacy\common\wp_booster\td_api.php

6 thoughts on “TagDiv Newspaper 9.7 Theme Update – Child theme Templates Fix”

  1. I tried adding in your additional code, but I don’t even see a td_api.php file in the wp-booster folder?

    1. Hey @Ap,

      I’ve just updated the article, as in the New version of the Newspaper theme, the files have been again moved to the td-composer plugin.

      Best!

  2. Hi,
    Overriding version 9.8 (td_api.php file look the same on 9.7, 9.7.3 and 9.8), I can’t see where to add the code because line 365 is inside a if statement/condition :
    and (stripos($the_component[‘file’], td_global::$get_template_directory) == 0)
    Any idea ?
    Thanks.

  3. Hi Duscan

    thanks for the solution ..
    I tried replacing the old code in the file td_api.php

    like this
    http://tinyurl.com/yxqfp8sv

    but its still not working may be I am doing somthing wrong

    Can you please point what I am doing wrong or may be better if you can share the file on mail

    1. Hey ojasya,

      Tell me which version on the theme you are using? I still haven’t checked 9.8+ versions, but will do soon.

Leave a Reply

Your email address will not be published. Required fields are marked *