Home API API – Smart Lists – Introduction

API – Smart Lists – Introduction

Available on: Newsmag V1.8+, Newspaper V5+

The td_api_smart_list class allows you to add or modify a smart list. In the following image you can see how Smart List – Style 1 looks in the frontend :

td_api_smart_list_frontend

The Smart List options are present on the post editing section, if you use the API to add a new style it will appear like this:

td_api_smart_lists_new_back

The theme smart lists are registered in td_config.php, the code looks like this:

td_api_smart_list::add('td_smart_list_1',
    array(
        'file' => td_global::$get_template_directory . '/includes/smart_lists/td_smart_list_1.php',
        'text' => 'Smart list 1',
        'img' => td_global::$get_template_directory_uri . '/images/panel/smart_lists/td_smart_list_1.png'
    )
);

Parameters:

$id (string) (required)

  • the smart list id – if you add a new smart list style the id has to be different from the ones used on the other smart list styles which are registered in theme, if you plan to modify one of the existing smart list 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 smart list style:
Key name
Type
Description
file string the path for the smart list template file
text string the title, it appears on post editing -> Smart List section
img string the smart list icon, it appears on post editing -> Smart List section