钩子文档

dynamic_sidebar_after

💡 云策文档标注

概述

dynamic_sidebar_after 是一个 WordPress 动作钩子,在动态侧边栏中的小部件渲染完成后触发。它适用于前端和后端,包括空侧边栏和 Widgets 屏幕上的非活动小部件侧边栏。

关键要点

  • 触发时机:在动态侧边栏的小部件渲染后执行。
  • 参数:$index(整数或字符串,表示侧边栏的索引、名称或ID)和 $has_widgets(布尔值,表示侧边栏是否包含小部件,默认值为 true)。
  • 应用场景:可用于前端和后端,包括空侧边栏和非活动小部件侧边栏。
  • 相关函数:与 dynamic_sidebar() 函数关联,用于显示动态侧边栏。
  • 版本历史:自 WordPress 3.9.0 版本引入。

📄 原文内容

Fires after widgets are rendered in a dynamic sidebar.

Description

Note: The action also fires for empty sidebars, and on both the front end and back end, including the Inactive Widgets sidebar on the Widgets screen.

Parameters

$indexint|string
Index, name, or ID of the dynamic sidebar.
$has_widgetsbool
Whether the sidebar is populated with widgets.
Default true.

Source

do_action( 'dynamic_sidebar_after', $index, true );

Changelog

Version Description
3.9.0 Introduced.