Title: CFS Options Screens
Author: Jon Christopher
Published: <strong>2014 年 7 月 24 日</strong>
Last modified: 2022 年 2 月 10 日

---

搜索插件

**该插件尚未通过WordPress的最新3个主要版本进行测试**。 当与较新版本的WordPress一起
使用时，可能不再受到维护或支持，并且可能会存在兼容性问题。

![](https://s.w.org/plugins/geopattern-icon/cfs-options-screens.svg)

# CFS Options Screens

 作者：[Jon Christopher](https://profiles.wordpress.org/jchristopher/)

[下载](https://downloads.wordpress.org/plugin/cfs-options-screens.1.2.7.zip)

 * [详情](https://cn.wordpress.org/plugins/cfs-options-screens/#description)
 * [评价](https://cn.wordpress.org/plugins/cfs-options-screens/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/cfs-options-screens/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/cfs-options-screens/#developers)

 [支持](https://wordpress.org/support/plugin/cfs-options-screens/)

## 描述

Build any number of options screens based on [Custom Field Suite](https://wordpress.org/plugins/custom-field-suite/).

#### For Example

Begin by creating Field Group(s) you want to include on your options screen. **Be
sure to set NO Placement Rules.** Once it’s created, note the post ID it uses. You
can then register any number of options screens like so:

    ```
    function my_cfs_options_screens( $screens ) {
        $screens[] = array(
            'name'            => 'options',
            'menu_title'      => __( 'Site Options' ),
            'page_title'      => __( 'Customize Site Options' ),
            'menu_position'   => 100,
            'icon'            => 'dashicons-admin-generic', // optional, dashicons-admin-generic is the default
            'field_groups'    => array( 'My Field Group' ), // Field Group name(s) of CFS Field Group to use on this page (can also be post IDs)
        );

        return $screens;
    }

    add_filter( 'cfs_options_screens', 'my_cfs_options_screens' );
    ```

#### Retrieve your options like so:

    ```
    $value = cfs_get_option( 'options_screen_name', 'cfs_field_name_from_field_group' );
    ```

You can set up multiple top level and/or children options pages by adding a `parent`
argument when registering your screen:

    ```
    function my_cfs_options_screens( $screens ) {

        // Parent
        $screens[] = array(
            'name'         => 'options',
            'field_groups' => array( 'My Parent Field Group Name' ),
        );

        // Child
        $screens[] = array(
            'name'         => 'options-nav',
            'parent'       => 'options', // name of the parent
            'field_groups' => array( 'My Child Field Group Name' ),
        );

        return $screens;
     }

     add_filter( 'cfs_options_screens', 'my_cfs_options_screens' );
    ```

You can also use CFS Options Screens to set up Field Group ‘defaults’, allowing 
a Field Group to appear both on a CFS Options Screen and a post edit screen. The
CFS Options Screen will act as the default/fallback and the post edit screen will
override those defaults.

    ```
    function my_cfs_options_screens( $screens ) {
        $screens[] = array(
            'name'            => 'options',
            'menu_title'      => __( 'Site Options' ),
            'page_title'      => __( 'Customize Site Options' ),
            'menu_position'   => 100,
            'icon'            => 'dashicons-admin-generic', // optional, dashicons-admin-generic is the default
            'field_groups'    => array(
                array(
                    'title'         => 'My CFS Field Group Name',
                    'has_overrides' => true,
                ),
            ),
        );

        return $screens;
    }

    add_filter( 'cfs_options_screens', 'my_cfs_options_screens' );
    ```

Check out the `cfs_options_screens_override_note_default` and `cfs_options_screens_override_note_override`
filters to customize the messaging for CFS Options Screens overrides.

## 安装

 1. Upload `cfs-options-screens` to the `/wp-content/plugins/` directory
 2. 通过WordPress的“插件”菜单激活插件
 3. Register your options screen(s) using the code snippets from this readme

## 常见问题

### How do I add a Field Group to my options screen?

You must specify the Field Group Title(s) in the `field_groups` parameter when using
the `cfs_options_screens` hook

### How do I retrieve saved options?

$value = cfs_get_option( ‘options_screen_name’, ‘field_name_from_field_group’ );

## 评价

此插件暂无评价。

## 贡献者及开发者

「CFS Options Screens」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ Jon Christopher ](https://profiles.wordpress.org/jchristopher/)

[帮助将「CFS Options Screens」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/cfs-options-screens)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/cfs-options-screens/)，
查看[SVN仓库](https://plugins.svn.wordpress.org/cfs-options-screens/)，或通过[RSS](https://plugins.trac.wordpress.org/log/cfs-options-screens/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/cfs-options-screens/)。

## 更新日志

#### 1.2.7

 * Add support for using CFS Field Group title instead of ID

#### 1.2.5

 * Better handling of overrides when not viewing a single post

#### 1.2.4

 * PHP Warning cleanup

#### 1.2.3

 * Fixed an issue that would output override note if any Field Group on an Options
   Screen had one
 * Fixed an issue where multiple override notes would be output when there were 
   multiple override Field Groups

#### 1.2.1

 * PHP Warning cleanup for `cfs_get_option`

#### 1.2

 * Added support for Field Group defaults/overrides where a Field Group can appear
   both on a CFS Options Screen and a post edit screen, and ‘fall back’ to the CFS
   Options Screen where applicable

#### 1.1.2

 * Refined the arguments for the underlying CPT to hide it from the Admin menu, 
   filterable with `cfs_options_screens_post_type_args`

#### 1.1.1

 * Fixed an issue resulting in a change in WordPress 4.4 that prevented editing 
   options screens

#### 1.1

 * Added new `cfs_get_options()` function to retrieve all CFS data for an options
   screen

#### 1.0.3

 * Fixed an issue in WordPress 4.3 where customized edit screen titles were not 
   shown

#### 1.0.2

 * Only show ‘Saved’ update notice when editing an options screen

#### 1.0.1

 * Proper page title is now output when editing a screen

#### 1.0

 * Initial release

## 额外信息

 *  版本 **1.2.7**
 *  最后更新：**5 年前**
 *  活跃安装数量 **400+**
 *  WordPress 版本 ** 3.9 或更高版本 **
 *  已测试的最高版本为 **5.9.0**
 *  语言
 * [English (US)](https://wordpress.org/plugins/cfs-options-screens/)
 * 标签
 * [cfs](https://cn.wordpress.org/plugins/tags/cfs/)[custom field suite](https://cn.wordpress.org/plugins/tags/custom-field-suite/)
   [options](https://cn.wordpress.org/plugins/tags/options/)[screen](https://cn.wordpress.org/plugins/tags/screen/)
   [settings](https://cn.wordpress.org/plugins/tags/settings/)
 *  [高级视图](https://cn.wordpress.org/plugins/cfs-options-screens/advanced/)

## 评级

 5 星（最高 5 星）。

 *  [  2 条 5 星评价     ](https://wordpress.org/support/plugin/cfs-options-screens/reviews/?filter=5)
 *  [  0 条 4 星评价     ](https://wordpress.org/support/plugin/cfs-options-screens/reviews/?filter=4)
 *  [  0 条 3 星评价     ](https://wordpress.org/support/plugin/cfs-options-screens/reviews/?filter=3)
 *  [  0 条 2 星评价     ](https://wordpress.org/support/plugin/cfs-options-screens/reviews/?filter=2)
 *  [  0 条 1 星评价     ](https://wordpress.org/support/plugin/cfs-options-screens/reviews/?filter=1)

[您的评价](https://wordpress.org/support/plugin/cfs-options-screens/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/cfs-options-screens/reviews/)

## 贡献者

 *   [ Jon Christopher ](https://profiles.wordpress.org/jchristopher/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/cfs-options-screens/)

## 捐助

您愿意支持这个插件的发展吗?

 [ 捐助此插件 ](http://mondaybynoon.com/donate/)