最后版本 |
您的文本 |
第1行: |
第1行: |
| 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. Create a blank text file named widget_list_all.php in your plugins folder, add the following php code. You should then be able to activate the List All plugin and the List-All-Blogs Widget on the plugins tab. Then look over in the presentation/widgets tab and you should have a new widget named List All Blogs Widget.
| |
|
| |
| 需要这个代码,创建widget显示所有博客的列表。取决于插件[http://wpmudev.org/project/List-All List-All],应该先安装这个插件。在你的插件文件夹中创建名为widget_list_all.php的空白文本文件,添加下面的php代码。然后你就能够激活插件标签上的List All插件和List-All-Blogs Widget。然后查看呈现/widget标签,你应该有个新的称为All Blogs Widget的widget。
| |
|
| |
| <pre> | | <pre> |
| <?php | | <?php |
第11行: |
第7行: |
| Author: Unkown - last edited Iolaire McFadden | | Author: Unkown - last edited Iolaire McFadden |
| Author URI: http://codex.wordpress.org/WPMU_List_All_Blogs_Widget | | 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');
| |
| ?>
| |
| </pre>
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
| <pre>
| |
| <?php
| |
| /*
| |
| 插件名: List-All-Blogs Widget
| |
| 插件 URI: http://codex.wordpress.org/WPMU_List_All_Blogs_Widget
| |
| 描述: 在WPMU上创建所有博客列表作为widget,从先前http://www.erik-rasmussen.com/blog/2006/11/30/widgetize-anything/上的代码为基础,转变
| |
| 作者: 未知- 最后由 Iolaire McFadden 编辑
| |
| 作者 URI: http://codex.wordpress.org/WPMU_List_All_Blogs_Widget
| |
| Version: 0.0.1 | | Version: 0.0.1 |
| */ | | */ |