I am using TagDiv block 7 in a sidebar widget but need to customise it to use square thumbnails.
I have already done a similar edit for the mega-menu so I know how to create the new thumbnail size and how to create a new block (7sq) in config.php.
I was expecting to then create a td-block-7sq.php but, unlike the mega-module I edited previously, the td_block_7.php does not seem to refer to a thumbnail size – What am I missing? should I be creating a new module?
I think I am not correctly understanding the structure of things. Are you able to explain?
(I am actually doing the edits via API and a child theme but assume if I understood how to do direct edits I can work out this side of things 🙂 )
Thanks
I had obviously looked at this too long yesterday as in the light of a new day I think I can see this a bit clearer now. I had begun to think of blocks as being the building block of a module but am thinking now it is the other way around. That it is the module that is repeated to make up the block. Is that correct?
I can’t test it out as I am currently unable to access our site but I will post again if I can’t sort it out.
Thanks
I think I am part way there.
With the help of the example in the API documentation, I have code for the new thumbnail, block and module, and have put what I thought was the correct code in the td_api_plugin.php (links to all code below)
1) The new block initially appeared in the visual composer but when used, and I tried to view the page, it gave a 404 error.
2) I directly edited td_page_builder_widgets.php to include the new block. The new block initially showed in the widgets but when used in a sidebar there were NO images on the page (the featured image also disappeared).
I didn’t know if I should reactivate the plugin after changes so tried to do so and now consistently get the following, and the widget of the new block is no longer available in the list:
wp booster error:
td_api_base::mark_used_on_page : a component with the ID: jc_block_7 is not set.
/homepages/8/d453795254/htdocs/SiteHome/wp-content/themes/Newspaper/includes/wp_booster/td_wp_booster_functions.php
Links to code:
https://dl.dropboxusercontent.com/u/4800576/TagDiv%20questions/jc_block_7.php
https://dl.dropboxusercontent.com/u/4800576/TagDiv%20questions/jc_module_6.php
https://dl.dropboxusercontent.com/u/4800576/TagDiv%20questions/td-api-plugin.php
I would really like to see where this code is wrong please to help my general understanding, but I have found an alternative solution for this particular need.
td_block_21 also uses square images but in the theme is not in the widgets list. Having now found the way to get blocks in the list I put the block 21 in there and works great. I assume I cannot edit this file via the API or child theme? A direct edit is not ideal even though it is a simple one.
Thanks
Hi,
Each block uses one (or two) module(s) to display the posts. For example block1 uses modules 4 and 6 – http://screencast.com/t/WBt6c0iw
On most modules there’s a thumbnail, they come in different sizes – http://screencast.com/t/4dIuc3exp
The thumbnails are registered in td_config.php – http://screencast.com/t/cyVQTwja
To add a new thumbnail you have to use the td_api_thumb::add API call – https://forum.tagdiv.com/td_api_thumbadd/
When you register a new block you have to use a strict name – http://screencast.com/t/1pSR20AXAZf – this is required because the theme loads only the necessary blocks code to improve the speed.
Make sure that the files are included in the plugin folder and their path is correct – http://screencast.com/t/TpQKBEd4oT0
For widgets registration try to use the following hook: – http://screencast.com/t/gIAV69k56ds
add_action('td_wp_booster_loaded', array($this, 'td_wp_booster_loaded'));
Add a function and the code required for registering the widget:
function td_wp_booster_loaded() {
...
}
Hope this helps, let me know how it goes.
Thank you!
-
This reply was modified 11 years by
Emil G.