Home API td_api_category_template::add

td_api_category_template::add

Available on: Newsmag V1.8+, Newspaper V5+
This api call is used to add a new category top section template to the theme.

Usage:

<?php td_api_category_template::add( $id, $params_array ) ?>

Parameters:

$id (string) (required)

  • the category top section template id – the id has to be different from the ones used on the other category top section template registered in theme

$params_array (array) (required)

  • an array which contains the parameters of the category top section template
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

Examples:

In the following example we’ll add Category Template 77 , you can see how the code looks on plugin, you have to modify the file path to match with the plugin current folder, ex:

td_api_category_template::add('td_category_template_77',
    array (
        'file' => $this->plugin_path . '/includes/category_templates/td_category_template_77.php',
        'img' => $this->plugin_url . '/images/panel/category_templates/icon-category-77.png',
        'text' => 'Style 77'
    )
);