从版本2.0开始,插件开发人员已经包含了许多可以在functions.php中使用的过滤器.这些包括Theme Mode,以及ot-loader.php状态中的注释;
* For developers: Theme mode.
*
* Run a filter and set to true to enable OptionTree theme mode.
* You must have this files parent directory inside of
* your themes root directory. As well, you must include
* a reference to this file in your themes functions.php.
* @since 2.0
*/
define( 'OT_THEME_MODE', apply_filters( 'ot_theme_mode', false ) );
Run Code Online (Sandbox Code Playgroud)
要在主题中激活选项树而不是作为插件,请在主题的根目录中包含所有插件文件,即
/可湿性粉剂内容/主题/我 - 真棒主题/选项树
并在functions.php你运行此过滤器,然后包含ot-loader.php文件.我在下面展示了这个,我还展示了show_pages过滤器;
add_filter( 'ot_theme_mode', '__return_true' );
add_filter( 'ot_show_pages', '__return_true' );
require_once ('option-tree/ot-loader.php');
Run Code Online (Sandbox Code Playgroud)
show_pages过滤器非常有用,因为在您设置了主题和选项之后,您将进入并将其设置为false,这样客户端就不会获得主要的"选项树"管理菜单,因此无法启动"修补"和垃圾箱一切.你把它改成了;
add_filter( 'ot_show_pages', '__return_false' );
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7939 次 |
| 最近记录: |