Create customized blocks

Posted in: Newsmag
Post count: 3

Hi,
I’ve added two custom blocks in my Newsmag child theme using your “td_api_module” and “td_api_block” class inside my functions.php:


td_api_module::add('td_module_17',
array(
'file' => get_stylesheet_directory() . '/includes/modules/td_module_17.php',
'text' => 'Module 17',
'img' => get_stylesheet_directory_uri() . '/images/panel/modules/td_module_17.png',
'used_on_blocks' => array('td_block_17'),
'excerpt_title' => 12,
'excerpt_content' => '',
'enabled_on_more_articles_box' => true,
'enabled_on_loops' => true,
'uses_columns' => true, // if the module uses columns on the page template + loop
'category_label' => true
)
);

td_api_block::add('td_block_17',
array(
'map_in_visual_composer' => true,
"name" => 'Block 17',
"base" => 'td_block_17',
"class" => 'td_block_17',
"controls" => "full",
"category" => 'Blocks',
'icon' => 'icon-pagebuilder-td_block_8',
'file' => get_stylesheet_directory() . '/includes/shortcodes/td_block_17.php',
"params" => array_merge(
td_global::get_map_filter_array(),
td_global::get_map_block_array()
)
)
);

I’ve added this module and block using the init-hook. The module then shows up inside the theme panel, e.g. categories. But “block 17” doesn’t appear inside the widget page. What am I doing wrong?

Another problem concerns the typography: Is it possible to change the h4 inside the block_title to h2?

Thanks!

Post count: 1291

Hi,

Look on how the other modules are added – http://screencast.com/t/8cQF0Ik4nwFe
And the blocks – http://screencast.com/t/bn1CKCZeEvz
And widgets – http://screencast.com/t/Pwhre1zCyZB

We will make a guide in the future, we’re still working to improve this section.

Thank you, Emil G.

Post count: 3

Hi,

thanks for your reply. The first two steps are working fine. But is there a possibility to add a block (in my case ‘td_block_17’) as a widget using a child theme?

Thank you!

Post count: 6600

Hi,

Unfortunately those files aren’t editable via child theme, you can find more details about child theme here: https://forum.tagdiv.com/child-theme-documentation-newsmag/
Please note though that the overwrite system for modules has been changed within latest theme update. As Emil also stated we will write a documentation on how to do this soon.

Thanks

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