Available on: Newsmag V1.8+, Newspaper V5+
This api call is used to add a new smart list style to the theme.
Usage:
<?php td_api_smart_list::add( $id, $params_array ) ?>
Parameters:
$id (string) (required)
- the smart list id – the id has to be different from the ones used on the other smart lists registered in theme
$params_array (array) (required)
- an array which contains the parameters of the smart list
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 |
Examples:
In the following example we’ll add Smart List 77 , you can see how the code looks on plugin, you have to modify the file path to match with the plugin current folder, we use the variables which were introduced in the Plugin Method section:
td_api_smart_list::add('td_smart_list_77', array( 'file' => $this->plugin_path . '/includes/smart_lists/td_smart_list_77.php', 'text' => 'Smart list 77', 'img' => $this->plugin_url . '/images/panel/smart_lists/td_smart_list_77.png' ) );