More td_api support in child theme

Posted in: Newspaper
Post count: 6

Hi,

I know that the theme API is not supported by the child theme but… Can you please tell me what do I need to load in the child-theme functions.php file so that I can get at least some basic support for td_config? At the moment I’m interested in adding new single post styles within the child theme’s structure (but not override the existing ones), just like you would for example use td_api_single_template::add(‘single_template_14’…
I can’t touch the main theme (td_config and so on) because I will lose everything at the next update.

I can handle the code, I just need some hints as to what should I do to be have td support within the child theme because I get “Class ‘td_api_single_template’ not found in ../child-theme/functions.php”. Should I create a new class to extend the main class td_config? What do I need to make it work properly?

Thank you!

Post count: 22421

Hello,

Unfortunately we have not tested the theme api in the child theme.Try using the theme api plugin that is provide in the theme main package under the code folder and this link in order to create a new post template: https://forum.tagdiv.com/td_api_single_templateadd/

Thank you!

Post count: 6

Update:

I’ve extended the td_config class just to see if it works properly and so far it seems to have no issues running from the child theme. Adding single_post_template_14.php seems to work properly, it shows in the WP backend > Theme Panel and the files are located in the child theme, and it works like they were on the main theme.

I just want to make sure that this approach doesn’t create any major problems in terms of vulnerability or conflicts, so far it seems to work just fine. I’m attaching a screenshot with my code, I’ll appreciate if you please check it out and let me know if I need to change something.

extended td_config class

Thanks!

Post count: 6

Hi Bogdan,

I see you posted at the same time as I was writing. I did look at all the documentation and tutorials, that’s where I got the code from and some insight on how you guys do things within the theme. The above solution seems to be working fine, do you think it’s a bad idea to keep using that extended class?

Post count: 22421

Hello,

If a major problem is created you will see it immediately as it will break the theme. I do not see a flaw in extending the class. It seems to be in order.

Thank you!

Post count: 22421

Hello,

If a major problem is created you will see it immediately as it will break the theme. I do not see a flaw in extending the class. It seems to be in order.

Thank you!

Post count: 6

Thank you Bogdan, it’s as I thought.

Have a great day!

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