td_api_category_top_posts_style::update

Available on: Newsmag V1.8+, Newspaper V5+
This api call is used to update the parameters of an existing category top section style.

Usage:

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

Parameters:

$id (string) (required)

  • the category top section style id – has to match with one of the category top section styles which are already registered in the 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 update the existing Category top Style 1 , 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::update('td_category_top_posts_style_1',
    array (
        'file' => $this->plugin_path . '/includes/category_top_posts_styles/td_category_top_posts_style_1.php',
        'posts_shown_in_the_loop' => 5,
        'img' => $this->plugin_url . '/images/panel/category_templates/icon-category-top-1.png',
        'text' => 'Style 1',
        'td_block_name' => 'td_block_big_grid'
    )
);