td_api_category_top_posts_style::update_key

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

Usage:

<?php td_api_category_top_posts_style::update_key( $id, $key, $value ) ?>

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

$key (string) (required)

  • parameter to be replaced, in the following table you can see all parameters but only one can be used because via this method you can update only one parameter:
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

$value (mixed) (required)

  • the data which will replace the parameter existing one, it’s type depends on the selected parameter.

Examples:

In the following example we’ll update the existing Category Style 1 ,  the ‘file’ key data will be replaced, 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_key('td_category_top_posts_style_1', 'file', $this->plugin_path . '/parts/header/header-style-1.php');