Best way to create a widget from a bespoke block

Posted in: Newspaper
Post count: 25

Hi,

Please could you tell me how to build a widget from a block I created with your api?

For sure it’s working if I edit directly td_page_builder_widgets.php and I add it here but it’s not working from the child theme.

Best regards,

Post count: 20685

Hi,

I remember trying to add a block as a widget a while back, but not through a child theme
https://forum.tagdiv.com/topic/registering-custom-widgets/
I don’t think it is possible from a child theme. Not all them files are supported to be used in a child theme.

If you use the tagDiv composer, now there are flex blocks which have a great deal of customization options, so maybe the result you achieved with the block you added can be achieved with a flex block.
With the cloud library you can design templates and create them entirely with the tagDiv composer, bypassing the need to use widgets
https://forum.tagdiv.com/tagdiv-cloud-library-plugin/
https://affiliate.tagdiv.com/#/load/All

Thanks

Post count: 25

Hi Simion,

Yes I want to use it from the theme child or plugins though.

Thanks to you I found this solution working within a plugin you have to put in your td-bespoke-plugin.php:

add_action('widgets_init', function() {
    return register_widget(new td_block_widget( 'td_block_bespoke' ));
});
  • This reply was modified 7 years by fgrenier.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.