API – Category top section template – Introduction

Available on: Newsmag V1.8+, Newspaper V5+
The td_api_category_template api call allows you to add a new category top section template or modify one of the theme existing category top section template. By default the theme uses Style 1 which displays the subcategories and a sort order dropdown box and it looks like this:

td_api_category_header

The style can be changed from the Theme Panel -> Categories section. If you use the theme API to add a new style it will appear like this:

td_api_category_header_new

The theme existing category top section template styles are registered in td_config.php, the code looks like this:

td_api_category_template::add('td_category_template_1',
    array (
        'file' => TDC_PATH_LEGACY . '/includes/category_templates/td_category_template_1.php',
        'img' => TDC_URL_LEGACY . '/assets/images/panel/category_templates/icon-category-1.png',
        'text' => 'Style 1',
        'group' => '' // '' - main theme, 'mob' - mobile theme, 'woo' - woo theme
    )
);

Parameters:

$id (string) (required)

  • the category top section template style id – if you add a new category top section template style the id has to be different from the ones used on the other category top section template styles registered in theme, if you plan to modify one of the existing styles the id has to match with the one you’re planing to modify.

$params_array (array) (required)

  • an array which contains the parameters of the category top section template style (file, img, text)
Key name
Type
Description
file string the path of the template file
img string the icon path, it appears in Theme Panel -> Categories
text string the title of the category top section template, it appears in Theme Panel -> Categories