Available on: Newsmag V1.8+, Newspaper V5+
The td_api_single_template class allows you to add or modify a single template. If no option is set the theme uses the default post template which looks like this:
The theme comes with a global option to set the post template style for each post which can be found in Theme Panel -> Post Settings and another option which overrides the global one and it can be found in the post edit section. If you use the api to add a new single template it will appear like this:
The theme single templates are registered in td_config.php, the code looks like this:
td_api_single_template::add('single_template_1', array( 'file' => TDC_PATH_LEGACY . '/parts/single/single_template_1.php', 'text' => 'Single template 1', 'img' => TDC_URL_LEGACY . '/assets/images/panel/single_templates/single_template_1.png', 'show_featured_image_on_all_pages' => false, ) );
Parameters:
$id (string) (required)
- the single template id – if you add a new single template the id has to be different from the ones used on the other single templates which are registered in theme, if you plan to modify one of the existing single 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 single template:
Key name
|
Type
|
Description
|
---|---|---|
file | string | the path of the single template file |
text | string | the name of the single template style |
img | string | the single template style icon, appears near the style name on post editing section |
show_featured_image_on_all_pages | boolean | force featured image display on all pages |
bg_disable_background | boolean | disable the featured image |
bg_box_layout_config | string | auto | td-boxed-layout | td-full-layout |
bg_use_featured_image_as_background | boolean | uses the featured image as a background |