Linux 软件免费装

Easy Widgets

开发者 OutThisLife
更新时间 2012年9月17日 23:10
PHP版本: 3.0 及以上
WordPress版本: 3.4.2
版权: GPLv2 or later
版权网址: 版权信息

标签

widgets custom widgets dynamic widgets

下载

1.1 1.1.1

详情介绍:

Easy Widgets plugin provides an API to easily add widgets in WordPress. Example of Use
  1. Create a file "widgets.php" in your themes /inc/ folder
  2. In functions.php use locate_template to include your widgets.php file: locate_template(array('/inc/widgets.php'), true);
  3. In widgets.php, do something like below:
/* * Custom widgets. / $prefix = 'replaceMe_'; $widgets = array(); // ----------------------------------------------- /* * easyBox widget / $widgets[] = array( 'id' => 'easyBox', 'title' => $prefix.'easyBox', 'desc' => 'Create a simple text widget', // All fields can be called by their // simple variables: title => $title 'fields' => array( array( 'name' => 'Title', 'id' => 'title', 'type' => 'text' ), array( 'name' => 'Body', 'id' => 'body', 'type' => 'textarea' ), array( 'name' => 'Category', 'id' => 'category', 'type' => 'select', 'options' => array( 'one', 'two', 'three' ) ) ), // This is what will appear in the sidebar as HTML 'output' => ' ' ); // ----------------------------------------------- /* * Iterate and register the widgets / if (class_exists('WidgetCreator')) { foreach ($widgets AS &$w) { $WC = new WidgetCreator($w); eval($WC->render()); } } else trigger_error('WidgetCreator does not exist.', E_USER_ERROR); Features Supported Field Types More to come soon, as it seems necessary. You may request new fields.

安装:

  1. Upload /easy-widgets/ to wp-content/plugins/ directory.
  2. Activate the plugin via the Plugins menu in WordPress.
  3. Follow the sample document.

常见问题:

Why do widgets start with a "!"?

This pushes the widget to the top of the widgets list, allowing your custom widgets to come first.

Can I use HTML?

Yes, you may use basic tags:

更新日志:

1.1.1 1.1 1.0