這個外掛並未在最新的 3 個 WordPress 主要版本上進行測試。開發者可能不再對這個外掛進行維護或提供技術支援,並可能會與更新版本的 WordPress 產生使用上的相容性問題。

Custom Options

外掛說明

Allows you to create custom options that you can easily update via the Options administration panel and also allows you to use mentioned options in your theme using a simple PHP function:

get_custom_option ( $slug [, $default_value, $field ] )

By default, only Administrators can change Custom Options, however you can use the filter gsp_custom_options_capability to change that. For example, if you wish to allow Editors to use Custom Options you can add this to your functions.php file:

function custom_options_capability ($capability) {
    return 'publish_pages';
}
add_filter ( 'gsp_custom_options_capability', 'custom_options_capability' );

Very simple, yet efficient.

螢幕擷圖

  • Administration view

安裝方式

  1. Upload the folder custom-options to the /wp-content/plugins/ directory
  2. Activate the plugin through the Plugins menu in WordPress
  3. Update the plugin through the Options menu in WordPress
  4. Use Custom Options in your theme through the PHP function get_custom_option( $slug, $default_value )
  5. Don’t forget to precede the function by an echo if you want to output it

常見問題集

What’s the difference between Custom Options and your old plugin Custom Configs/Settings?

From a user’s point of view, nothing. However, from a developer’s point of view, this new plugin is somewhat cleaner. Options are now saved in a serialized array in the WordPress options table.

Is Custom Options backward compatible with Custom Configs/Settings?

No.

使用者評論

閱讀全部 1 則使用者評論

參與者及開發者

以下人員參與了開源軟體〈Custom Options〉的開發相關工作。

參與者

將〈Custom Options〉外掛本地化為台灣繁體中文版

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄

變更記錄

1.2

  • Added the filter gsp_custom_options_capability to customize what capability has access to Custom Options.

1.1

  • Added the field parameter. The function can now receive a new optional parameter: $field which defaults to value and if set to label will display the title of label of the custom option. As requested by Jam Tin on the forums.

1.0

  • First stable version