wp_dashboard_rss_output()
云策文档标注
概述
wp_dashboard_rss_output() 函数用于在 WordPress 仪表盘中显示通用的 RSS 小部件内容。它通过调用 wp_widget_rss_output() 来输出 RSS 条目列表。
关键要点
- 函数接受一个必需的字符串参数 $widget_id,用于标识特定的仪表盘小部件。
- 内部使用 get_option() 获取仪表盘小部件选项,并传递给 wp_widget_rss_output() 进行内容渲染。
- 此函数自 WordPress 2.5.0 版本引入,是仪表盘 RSS 功能的核心部分。
代码示例
wp_dashboard_rss_output( $widget_id ) {
$widgets = get_option( 'dashboard_widget_options' );
echo '';
wp_widget_rss_output( $widgets[ $widget_id ] );
echo '';
}相关函数
- wp_widget_rss_output(): 在 wp-includes/widgets.php 中定义,用于显示 RSS 条目列表。
- get_option(): 在 wp-includes/option.php 中定义,用于根据选项名检索选项值。
原文内容
Display generic dashboard RSS widget feed.
Parameters
$widget_idstringrequired
Source
function wp_dashboard_rss_output( $widget_id ) {
$widgets = get_option( 'dashboard_widget_options' );
echo '<div class="rss-widget">';
wp_widget_rss_output( $widgets[ $widget_id ] );
echo '</div>';
}
Changelog
| Version | Description |
|---|---|
| 2.5.0 | Introduced. |