<?php
/**
* 框架配置文件
* 全字段配置请参阅: http://docs.reduxframework.com/
*/
if ( ! class_exists( 'Redux' ) ) {
return;
}
// 配置项存储在数据库中的字段名,请不要与其他插件或主题字段重复,确保唯一性.
$opt_name = "jcy";
/**
* ---> 设置参数
* 所有可以配置的参数都在这里.
* 更多参阅官方: https://github.com/ReduxFramework/ReduxFramework/wiki/Arguments
* */
$theme = wp_get_theme(); // 用于某些设置。不是必需
$args = array(
// 典型> -根据需要更改这些值
'opt_name' => $jcy,
// 这个字段保存在你的数据库里,主题设置项opt_name 可以在数据库里面找到,也是你的全局变量名
'display_name' => $theme->get( 'Name' ),
// 出现在面板顶部的名称。
'display_version' => $theme->get( 'Version' ),
// 出现在面板顶部的版本号。
'menu_type' => 'menu',
// 在admin菜单上显示,参数:menu 或 submenu(只在开启时显示)
'allow_sub_menu' => true,
// 是否在admin上显示主题设置子菜单
'menu_title' => '主题设置', // 设置左侧栏主题设置菜单名
'page_title' => '九刺鱼主题设置', // 设置浏览器和admin工具条上的菜单名
// 您需要生成一个谷歌API键来使用此功能。
// Please visit: https://developers.google.com/fonts/docs/developer_api#Auth
'google_api_key' => '',谷歌api key - 用于谷歌字体升级,可以不理会
// 是否每周更新谷歌字体,最好保持false
'google_update_weekly' => false,
// 必须定义为在排版模块中添加谷歌字体。
'async_typography' => true,
// 在前端或字符串上使用异步字体。
'disable_google_fonts_link' => true,// 如果您想创建自己的谷歌字体加载程序,请禁用此选项
'admin_bar' => true,
// 是否在admin工具条上显示主题设置菜单名
'admin_bar_icon' => 'dashicons-portfolio',
// 为管理栏菜单选择一个图标
'admin_bar_priority' => 50,
// 选择管理栏菜单的优先级
'global_variable' => '',
// 设置主题设置的全局变量 参照本例:命名空间_主题名称
'dev_mode' => true,//开发者模式
// 显示页面加载的时间等
'update_notice' => true,
// 升级通告
'customizer' => true,
// 个人定制
//'open_expanded' => true, // 允许您以展开的方式开始面板。
//'disable_save_warn' => true, // 当用户更改字段时禁用“保存警告”
// 选购->给你额外的功能
'page_priority' => null,
// null页面优先级,选择主题设置菜单在左侧显示的位置
'page_parent' => 'themes.php',
// For a full list of options, visit: http://codex.wordpress.org/Function_Reference/add_submenu_page#Parameters
'page_permissions' => 'manage_options',
// 设置权限,访问选项面板所需的权限
'menu_icon' => '',
// 指定图标的自定义URL
'last_tab' => '',
// 强制面板总是打开一个 li(审查元素,找到li标签对应的id数值,比如id="1_section_group_li",就是1)
'page_icon' => 'icon-themes',
// 图标显示在管理面板旁边的menu_title
'page_slug' => '_options',
// 页面别名用来表示面板,将基于页面标题,然后菜单标题,然后如果没有提供
'save_defaults' => true,
// 更新设之前是否先保存一遍默认设置
'default_show' => true,
// 如果为true,则显示每个字段旁边的默认值,该值不是默认值。
'default_mark' => '',//设置项标题后面的标记,可以使用*号
// 设置项标题后面的标记,可以使用*号
'show_import_export' => true,
// 显示导入导出设置
// 小心- >这些选项只供高级使用。
'transient_time' => 60 * MINUTE_IN_SECONDS,
'output' => true,
// 框架动态CSS输出的全局关闭。也将禁用谷歌字体输出
'output_tag' => true,
// 允许动态CSS是定制和谷歌的字体生成,但停止动态CSS去头
// 'footer_credit' => '', // 禁用Redux页脚信用。如果你能帮助,请离开。
// 未来>尚未使用,但保留或部分实现。自行使用风险。
'database' => '',
// 可能的选项options, theme_mods, theme_mods_expanded, transient。不完全功能,警告!
'use_cdn' => true,
// 是否使用cdn 如果不使用 CDN for Select2, Ace Editor, and others, 你可以下载后集成进框架代码。
//'compiler' => true,//编译器
// 提示 提示框的参数
'hints' => array(
'icon' => 'el el-question-sign',
'icon_position' => 'right',
'icon_color' => 'lightgray',
'icon_size' => 'normal',
'tip_style' => array(
'color' => 'light',
'shadow' => true,
'rounded' => false,//圆形的
'style' => '',
),
'tip_position' => array(
'my' => 'top left',
'at' => 'bottom right',
),
'tip_effect' => array(
'show' => array(
'effect' => 'slide',
'duration' => '500',
'event' => 'mouseover',
),
'hide' => array(
'effect' => 'slide',
'duration' => '500',
'event' => 'click mouseleave',
),
),
)
);
// 管理栏链接>在管理栏菜单中设置自定义链接作为外部项目
$args['admin_bar_links'][] = array(
'id' => 'redux-docs',
'href' => 'http://docs.reduxframework.com/',
'title' => '官方文档',
);
// 社交图标
$args['share_icons'][] = array(
'url' => 'https://github.com/ReduxFramework/ReduxFramework',
'title' => 'Visit us on GitHub',
'icon' => 'el el-github'
//'img' => '', // You can use icon OR img. IMG needs to be a full URL.
);
// 窗体前的面板介绍文本
if ( ! isset( $args['global_variable'] ) || $args['global_variable'] !== false ) {
if ( ! empty( $args['global_variable'] ) ) {
$v = $args['global_variable'];
} else {
$v = str_replace( '-', '_', $args['opt_name'] );
}
$args['intro_text'] = sprintf('<p>框架设置了一个全局变量: <strong>$%1$s</stron>使用前请先引入全局变量一次,可以放在header.php,你可以通过调用<strong> $%1$s[\'设置项id\'] </strong>来调用设置保存值,同时可以通过配置文件来修改这个变量名!</p>', $v );
} else {
$args['intro_text'] = '<p>这个信息将显示于面板底部,不是必需的,但可以提供更多提示。允许使用html标签.</p>';
}
// 添加表单后面的内容。
$args['footer_text'] = '<p>这个信息将显示于面板底部,不是必需的,但可以提供更多提示。允许使用html标签</p>';
Redux::setArgs( $opt_name, $args );
/*
* ---> END ARGUMENTS
*/
/*
* ---> START HELP TABS
*/
$tabs = array(
array(
'id' => 'redux-help-tab-1',
'title' => '主题信息 1',
'content' => '<p>这是选项卡内容,HTML是允许的</p>'
),
array(
'id' => 'redux-help-tab-2',
'title' => '主题信息 2',
'content' => '<p>这是选项卡内容,HTML是允许的</p>'
)
);
Redux::setHelpTab( $opt_name, $tabs );
// Set the help sidebar
$content = '<p>这是侧边栏内容,HTML是允许的.</p>';
Redux::setHelpSidebar( $opt_name, $content );
/*
* <--- END HELP TABS
*/
/*
*
* ---> 选项设置
*
*/
/*
As of Redux 3.5+, there is an extensive API. This API can be used in a mix/match mode allowing for
*/
// -> 基础字段
Redux::setSection( $opt_name, array(
'title' => '常规设置',
'id' => 'basic',
'desc' => '基本选项设置.',
'icon' => 'el el-home',
'fields' => array(
array(
'id' => 'opt-text',
'type' => 'text',
'title' => __( 'Example Text', 'redux-framework-demo' ),
'desc' => __( 'Example description.', 'redux-framework-demo' ),
'subtitle' => __( 'Example subtitle.', 'redux-framework-demo' ),
'hint' => array(
'content' => 'This is a <b>hint</b> tool-tip for the text field.<br/><br/>Add any HTML based text you like here.',
)
)
)
) );
Redux::setSection( $opt_name, array(
'title' => __( 'Basic Fields', 'redux-framework-demo' ),
'id' => 'basic',
'desc' => __( 'Basic fields as subsections.', 'redux-framework-demo' ),
'icon' => 'el el-home'
) );
Redux::setSection( $opt_name, array(
'title' => __( 'Text', 'redux-framework-demo' ),
'desc' => __( 'For full documentation on this field, visit: ', 'redux-framework-demo' ) . '<a href="//docs.reduxframework.com/core/fields/text/" target="_blank">//docs.reduxframework.com/core/fields/text/</a>',
'id' => 'opt-text-subsection',
'subsection' => true,
'fields' => array(
array(
'id' => 'text-example',
'type' => 'text',
'title' => __( 'Text Field', 'redux-framework-demo' ),
'subtitle' => __( 'Subtitle', 'redux-framework-demo' ),
'desc' => __( 'Field Description', 'redux-framework-demo' ),
'default' => 'Default Text',
),
)
) );
Redux::setSection( $opt_name, array(
'title' => __( 'Text Area', 'redux-framework-demo' ),
'desc' => __( 'For full documentation on this field, visit: ', 'redux-framework-demo' ) . '<a href="//docs.reduxframework.com/core/fields/textarea/" target="_blank">//docs.reduxframework.com/core/fields/textarea/</a>',
'id' => 'opt-textarea-subsection',
'subsection' => true,
'fields' => array(
array(
'id' => 'textarea-example',
'type' => 'textarea',
'title' => __( 'Text Area Field', 'redux-framework-demo' ),
'subtitle' => __( 'Subtitle', 'redux-framework-demo' ),
'desc' => __( 'Field Description', 'redux-framework-demo' ),
'default' => 'Default Text',
),
)
) );
if ( file_exists( dirname( __FILE__ ) . '/../README.md' ) ) {
$section = array(
'icon' => 'el el-list-alt',
'title' => '文档说明',
'fields' => array(
array(
'id' => '17',
'type' => 'raw',
'markdown' => true,
'content_path' => dirname( __FILE__ ) . '/../README.md', // 完整路径,不是相对的,请注意
//'content' => 'Raw content here',
),
),
);
Redux::setSection( $opt_name, $section );
}
/*
* <--- END SECTIONS
*/
/*
*
* --> Action hook 的例子
*
*/
//add_action( 'redux/loaded', 'remove_demo' );这将删除演示通知和链接
//add_filter('redux/options/' . $opt_name . '/compiler', 'compiler_action', 10, 3); //10以上是一个优先考虑的问题,但2需要将动态生成的CSS包括到函数中。
//add_filter('redux/options/' . $opt_name . '/args', 'change_arguments' ); //在声明后,在创建面板之前更改参数
//add_filter('redux/options/' . $opt_name . '/defaults', 'change_defaults' ); //在使用前更改默认字段值
//add_filter('redux/options/' . $opt_name . '/sections', 'dynamic_section'); //动态添加一个部分。也可以用来修改选项/字段。
九刺鱼框架配置
最新推荐文章于 2019-12-09 10:37:25 发布