I’m trying to create some custom modules to display the subcategory instead of the top-level category over images:
<div class="td-module-image">
<?php echo $this->get_image('td_324x160');?>
<?php if (td_util::get_option('tds_category_module_2') == 'yes') { echo $this->get_category(); }?>
</div>
Is there an easy way to do this? I’ve been unsuccessful trying to use the id from the array when I print_r($this). My plan was to run a loop on each post’s ID to get the lowest child category:
foreach($categories as $category) :
$children = get_categories( array ('parent' => $category->term_id ));
$has_children = count($children);
if ( $has_children == 0 ) {
echo '<h1>' . $category->name . '</h1>';
}
endforeach;
Thanks in advance!
Hello jciview,
Unfortunately, our theme does not have such a simple option to display as you wish, sorry! Please notice that is not a simple task and require some additional customizations through code that involve custom modifications. Please notice that if you want to create a new module with custom functionality, you have to use API method for implementation and this type of method is not covered by our support. For more information about this, you have to check our documentation here -> https://forum.tagdiv.com/td_api_moduleadd/ If you need to display more levels in our theme and you are not aware of the steps which are needed to take in this regard, please consider hiring a freelancer/developer to help you because we cannot provide customization services at the moment, sorry!
Thank you for your understanding!
Hi jciview,
at the end you managed to show the subcategories?
Hello bitottantotto,
Unfortunately, I do not exactly understand what you mean, but please notice that our theme does not have such a simple option to change the categories or subcategories from the theme. Any modification involves custom work and we cannot provide this type of service, sorry!
Thanks for your understanding!
