get_most_active_blogs
函数
get_most_active_blogs ( $num = 10, $display = true )
- 参数
-
-
(int)
$num
Optional. Number of activate blogs to retrieve. Default 10.- Required: 否
- Default: 10
-
(bool)
$display
Optional. Whether or not to display the most active blogs list. Default true.- Required: 否
- Default: true
-
(int)
- 返回值
-
- (array) List of “most active” sites.
- 定义位置
-
-
wp-includes/ms-deprecated.php
, line 219
-
wp-includes/ms-deprecated.php
- 引入
- –
- 弃用
- 3.0.0
Deprecated functionality to retrieve a list of the most active sites.
function get_most_active_blogs( $num = 10, $display = true ) { _deprecated_function( __FUNCTION__, '3.0.0' ); $blogs = get_blog_list( 0, 'all', false ); // $blog_id -> $details if ( is_array( $blogs ) ) { reset( $blogs ); $most_active = array(); $blog_list = array(); foreach ( (array) $blogs as $key => $details ) { $most_active[ $details['blog_id'] ] = $details['postcount']; $blog_list[ $details['blog_id'] ] = $details; // array_slice() removes keys! } arsort( $most_active ); reset( $most_active ); $t = array(); foreach ( (array) $most_active as $key => $details ) { $t[ $key ] = $blog_list[ $key ]; } unset( $most_active ); $most_active = $t; } if ( $display ) { if ( is_array( $most_active ) ) { reset( $most_active ); foreach ( (array) $most_active as $key => $details ) { $url = esc_url('http://' . $details['domain'] . $details['path']); echo '
“;
}
}
}
return array_slice( $most_active, 0, $num );
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。