wpsc_render_partial()
Renders a partial/template.
The global $current_user is made available for any rendered template.
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
wpsc_render_partial( $partial, $page_vars );
- $partial(строка) (обязательный)
- - Filename under ./partials directory, with or without .php (appended if absent).
- $page_vars(массив)
- - Variables made available for the template.
По умолчанию: array()
Код wpsc_render_partial() wpsc render partial WPSCache 1.12.4
function wpsc_render_partial( $partial, array $page_vars = array() ) { if ( ! str_ends_with( $partial, '.php' ) ) { $partial .= '.php'; } if ( strpos( $partial, 'partials/' ) !== 0 ) { $partial = 'partials/' . $partial; } $path = __DIR__ . '/' . $partial; if ( ! file_exists( $path ) ) { return; } foreach ( $page_vars as $key => $val ) { $$key = $val; } global $current_user; include $path; }