WordPress: WPMU List All Blogs Widget:修订间差异
来自站长百科
(新页面: This code is the code needed to create a widget to show a list of all blogs. It is dependent on the plug-in [http://wpmudev.org/project/List-All List-All], that should be installed first...) |
无编辑摘要 |
||
第1行: | 第1行: | ||
<pre> | <pre> | ||
<?php | <?php |
2008年9月25日 (四) 13:51的版本
<?php /* Plugin Name: List-All-Blogs Widget Plugin URI: http://codex.wordpress.org/WPMU_List_All_Blogs_Widget Description: Creates a list of all blogs on a WPMU site as a widget, conversion from previous version based on code in http://www.erik-rasmussen.com/blog/2006/11/30/widgetize-anything/ Author: Unkown - last edited Iolaire McFadden Author URI: http://codex.wordpress.org/WPMU_List_All_Blogs_Widget Version: 0.0.1 */ function widget_list_all_blogs_init() { if ( !function_exists('register_sidebar_widget') ) return; function widget_list_all_blogs($args) { extract($args); if(function_exists(list_all_wpmu_blogs)) { echo $before_widget; echo $before_title . 'All Blogs' . $after_title; echo "<ul>\n"; list_all_wpmu_blogs('100', 'name', '<li>', '</li>', 'updated'); echo "</ul>\n"; echo $after_widget; } else { echo "Error - function list_all_wpmu_blogs not found"; } } if ( function_exists('wp_register_sidebar_widget') ) // fix for wordpress 2.2.1 wp_register_sidebar_widget(sanitize_title('Widgetize list all blogs' ), 'Widgetize list all blogs', 'widget_list_all_blogs', array(), 1); else register_sidebar_widget('Widgetize list all blogs', 'widget_list_all_blogs', 1); } add_action('plugins_loaded', 'widget_list_all_blogs_init'); ?>