astra_addon_get_template( string $template_name, array $args = array(), string $template_path = '', string $default_path = '' )
Get other templates (e.g. blog layout 2/3, advanced footer layout 1/2/3/etc) passing attributes and including the file.
Description
Parameters
- $template_name
-
(string) (Required) template path. E.g. (directory / template.php).
- $args
-
(array) (Optional) (default: array()).
Default value: array()
- $template_path
-
(string) (Optional) (default: '').
Default value: ''
- $default_path
-
(string) (Optional) (default: '').
Default value: ''
Return
(void)
Source
File: classes/class-astra-templates.php
function astra_addon_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { $located = astra_addon_locate_template( $template_name, $template_path, $default_path ); if ( ! file_exists( $located ) ) { /* translators: 1: file location */ _doing_it_wrong( __FUNCTION__, esc_html( sprintf( __( '%s does not exist.', 'astra-addon' ), '<code>' . $located . '</code>' ) ), '1.0.0' ); return; } // Allow 3rd party plugin filter template file from their plugin. $located = apply_filters( 'astra_addon_get_template', $located, $template_name, $args, $template_path, $default_path ); do_action( 'astra_addon_before_template_part', $template_name, $template_path, $located, $args ); include $located; do_action( 'astra_addon_after_template_part', $template_name, $template_path, $located, $args ); }
Expand full source code Collapse full source code View on Trac
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |