API – Top Bar Template – Introduction

Available on: Newsmag V1.8+, Newspaper V5+
The td_api_top_bar_template class allows you to add or modify a top bar template. The theme default top bar looks like this:

td_api_top_bar_frontend

The top bar template can be changed from Theme Panel -> Header -> Top Bar section, if you use the api to add a new top bar template it will appear like this:

td_api_top_bar_new_backend

The theme top bar templates are registered in td_config.php, the code looks like this:

td_api_top_bar_template::add('td_top_bar_template_1',
    array(
        'img' => td_global::$get_template_directory_uri . '/images/panel/top_bar_templates/icon-top-bar-1.png.png',
        'file' => td_global::$get_template_directory . '/parts/header/td_top_bar_template_1.php'
    )
);

Parameters:

$id (string) (required)

  • the top bar template id – if you add a new top bar template the id has to be different from the ones used on the other top bar templates which are registered in theme, if you plan to modify one of the existing top bar template the id has to match with the one you’re planing to modify.

$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