td_api_category_top_posts_style::add

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

Usage:

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

Parameters:

$id (string) (required)

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

$params_array (array) (required)

  • an array which contains the parameters of the category top section style
Key name
Type
Description
file string the path of the template file
posts_shown_in_the_loop integer the number of posts displayed in the loop
img string the icon path, it appears on Theme Panel -> Categories
text string the title of the category top section style, it appears in Theme Panel -> Categories
td_block_name string the block used on this section, by default it’s the Big Grid block

Examples:

In the following example we’ll add Category top Style 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_top_posts_style::add('td_category_top_posts_style_77',
    array (
        'file' => $this->plugin_path . '/includes/category_top_posts_styles/td_category_top_posts_style_77.php',
        'posts_shown_in_the_loop' => 5,
        'img' => $this->plugin_url . '/images/panel/category_templates/icon-category-top-77.png',
        'text' => 'Style 77',
        'td_block_name' => 'td_block_big_grid'
    )
);