td_api_top_bar_template::add

Available on: Newsmag V1.8+, Newspaper V5+
This API call is used to add a new top bar template to the theme.

Usage:

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

Parameters:

$id (string) (required)

  • the top bar template id – the id has to be different from the ones used on the other top bar templates registered in theme

$params_array (array) (required)

  • an array which contains the parameters of the top bar template
Key name
Type
Description
img string the top bar template icon, appears in Theme Panel -> Header section
file string the path of the top bar template file

Examples:

In the following example we’ll add Top Bar Template 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, ex:

td_api_top_bar_template::add('td_top_bar_template_77',
    array(
        'img' => $this->plugin_url . '/images/panel/top_bar_templates/icon-top-bar-77.png.png',
        'file' => $this->plugin_path . '/parts/header/td_top_bar_template_77.php'
    )
);