GC_Customize_Nav_Menus::render_nav_menu_partial()
最后更新于:2021-11-27 04:37:05
GC_Customize_Nav_Menus::render_nav_menu_partial( GC_Customize_Partial$partial, array$nav_menu_args)Render a specific menu via gc_nav_menu() using the supplied arguments.
参数
- $partial
-
(GC_Customize_Partial) (Required) Partial.
- $nav_menu_args
-
(array) (Required) Nav menu args supplied as container context.
响应
(string|false)
源文件
文件: gc-includes/class-gc-customize-nav-menus.php
public function render_nav_menu_partial( $partial, $nav_menu_args ) {
unset( $partial );
if ( ! isset( $nav_menu_args['args_hmac'] ) ) {
// Error: missing_args_hmac.
return false;
}
$nav_menu_args_hmac = $nav_menu_args['args_hmac'];
unset( $nav_menu_args['args_hmac'] );
ksort( $nav_menu_args );
if ( ! hash_equals( $this->hash_nav_menu_args( $nav_menu_args ), $nav_menu_args_hmac ) ) {
// Error: args_hmac_mismatch.
return false;
}
ob_start();
gc_nav_menu( $nav_menu_args );
$content = ob_get_clean();
return $content;
}