Managing a new block as a widget with a child theme

Posted in: Newspaper
Post count: 6

I’m using Newspaper with a child theme.
I had to create a new block with specific content to use it in a sidebar. For this, I followed your very clear example (https://forum.tagdiv.com/practical-example-how-to-add-a-new-block-and-module/).

To display the block as a widget, I added some code in the td_page_builder_widgets.php file.
But the only way to make it works seems to add this code in the original file of the Newspaper theme.
I tried to create a copy of this file in my child theme (../child_theme/includes/widgets/td_page_builder_widgets.php) but it doesn’t work.

Modifying an original file in the parent theme will be a problem each time I will upgrade the theme.
Is there a method to manage this block widget directly in the child theme?

Best,

David

Post count: 23312

Hello Caum,

At the moment, unfortunately, this is not possible using our child theme because you will have to register your block in td_page_builder_widgets.php as the widget with add_action and this type of file do not support to be overwritten in the child theme, sorry! At the moment, the only way for it is using this in the main theme.
We certainly plan to extend the theme flexibility in the future updates. I’ve added your suggestion on our list and when the time comes our developers will consider it. This may take some time because we have a long implementation list and we take them one by one.

Thanks for your suggestion, have a nice day.

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