I am trying to add a new category top section style
https://forum.tagdiv.com/td_api_category_top_posts_styleadd/
using the plugin method
https://forum.tagdiv.com/the-plugin-method/
My plugin folder structure
td-api-plugin
– td-api-plugin.php
– includes
– – category_top_posts_styles
– – – td_category_top_posts_style_77.php
– images
– – panel
– – – category_templates
– – – – icon-category-top-77.png
My td-api-plugin.php code
<?php
/*
Plugin Name: td-api-plugin
Plugin URI: http://tagdiv.com
Description: tagDiv API plugin
Author: tagDiv
Version: 1.0.2
Author URI: http://tagdiv.com
*/
class td_api_plugin {
var $plugin_url = '';
var $plugin_path = '';
function __construct() {
$this->plugin_url = plugins_url('', __FILE__);
$this->plugin_path = dirname(__FILE__);
add_action('td_global_after', array($this, 'hook_td_global_after'));
}
function hook_td_global_after() {
// Add a new category top posts style
td_api_category_top_posts_style::add('td_category_top_posts_style_77',
array (
'file' => $this->plugin_path . '/includes/category_top_posts_styles/td_category_top_posts_style_77.php',
'posts_shown_in_the_loop' => 1,
'img' => $this->plugin_url . '/images/panel/category_templates/icon-category-top-77.png',
'text' => 'Style 77',
'td_block_name' => 'td_block_big_grid_77'
)
);
}
}
new td_api_plugin();
td_category_top_posts_style_77.php code
<?php
class td_category_top_posts_style_77 extends td_category_top_posts_style {
function show_top_posts() {
parent::render_posts_to_buffer();
if (parent::get_rendered_post_count() == 0) {
return; // die here
}
?>
<div class=”td-category-grid td-container-wrap”>
<div class=”td-container”>
<div class=”td-pb-row”>
<div class=”td-pb-span12″>
<?php
echo parent::get_buffer();
?>
</div>
</div>
</div>
</div>
<?php
}
}
I am able to see the addition of the new category top posts style in the panel. I am able to select it and save the settings but get the following error on the category page.
wp_booster error:
td_api_base::mark_used_on_page : a component with the ID: td_block is not set.
…/wp-content/themes/Newspaper/includes/wp_booster/td_api.php
Any pointers to were I am going wrong would be helpful.
Thanks.
Hi,
Please make sure that the tagDiv Composer is activate.
Please make sure that all the settings are like in our requirements, please follow the guide carefully
– https://forum.tagdiv.com/requirements-for-newspaper/
and please increase all requirements that are lower, and follow all steps.
Please make sure that you do not have a plugin conflict, please deactivate all non theme plugins, also if you are using child theme or cache plugin, please deactivate them, clear all cache and try again.
Thank you!