Home API td_api_header_style::add

td_api_header_style::add

Available on: Newsmag V1.8+, Newspaper V5+
This api call is used to add header styles to the theme.

Usage:

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

Parameters:

$id (string) (required)

  • the header style id – has to be different from the id’s used on the header styles which are already registered in the theme
  • example of valid $id’s: 77, td_header_style_77 etc.

$params_array (array) (required)

  • an array which contains the parameters of the header style:
Key name
Type
Description
text string the title of the header style, it appears in Theme Panel -> Header -> Header Style
file string the path of the template file

Examples:

In the following example we’ll add Header 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, we use the variables which were introduced in the Plugin Method section:

td_api_header_style::add('77',
    array(
        'text' => '<strong>Style 77 - </strong> default',
        'file' => $this->plugin_path . '/parts/header/header-style-77.php'
    )
);