Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在主题中包含Redux框架_Php_Wordpress_Themes_Redux Framework - Fatal编程技术网

Php 如何在主题中包含Redux框架

Php 如何在主题中包含Redux框架,php,wordpress,themes,redux-framework,Php,Wordpress,Themes,Redux Framework,如何在主题wordpress中包含Redux框架 此代码不起作用: <?php if ( !class_exists( 'ReduxFramework' ) && file_exists( dirname( __FILE__ ) . '/ReduxFramework/ReduxCore/framework.php' ) ) { require_once( dirname( __FILE__ ) . '/ReduxFramework/ReduxCore/frame

如何在主题wordpress中包含Redux框架

此代码不起作用:

<?php
  if ( !class_exists( 'ReduxFramework' ) && file_exists( dirname( __FILE__ ) . '/ReduxFramework/ReduxCore/framework.php' ) ) {
    require_once( dirname( __FILE__ ) . '/ReduxFramework/ReduxCore/framework.php' );
  }
  if ( !isset( $redux_demo ) && file_exists( dirname( __FILE__ ) . '/ReduxFramework/sample/sample-config.php' ) ) {
    require_once( dirname( __FILE__ ) . '/ReduxFramework/sample/sample-config.php' );
  }
?>

对于我的作品:

    // load the theme's framework
if ( !class_exists( 'ReduxFramework' ) && file_exists( dirname(__FILE__) . '/framework/ReduxCore/framework.php' ) ) {
require_once( dirname(__FILE__) . '/framework/ReduxCore/framework.php' );
}

// load the theme's options 
if ( !isset( $redux_owd ) && file_exists( dirname(__FILE__) . '/framework/sample/sample-config.php' ) ) {
require_once( dirname(__FILE__) . '/framework/sample/sample-config.php' );
}
我有文件夹框架结束在他我有ReduxCore结束样本文件夹…检查代码。。。

剧透警报,这里是Redux的开发负责人。您可以使用Redux生成器获取一个管理文件夹,从而避免一些麻烦


毕竟,这是一项免费服务。:)

在functions.php中使用此选项

// this will deactive demo mode of reduxframework plugin and will not display and addvertisement

if ( ! function_exists( 'redux_disable_dev_mode_plugin' ) ) {
        function redux_disable_dev_mode_plugin( $redux ) {
            if ( $redux->args['opt_name'] != 'redux_demo' ) {
                $redux->args['dev_mode'] = false;
            }
        }

        add_action( 'redux/construct', 'redux_disable_dev_mode_plugin' );
    }

// add sample config to overwrite reduxcore/framework.php

if (!isset($redux_demo)){
    require_once(dirname(__FILE__) . '/sample-config.php');
}
要安装reduxframework插件,您需要tgm插件

您将从这里获得tgm插件-->

在主题函数中包含tgm插件,或者在functions.php中复制和使用tgm-init.php代码,不要忘记class-tgm-plugin-activation.php

示例-->安装redux框架插件

$plugins = array( // add below code to add redux framework plugin

        array(
            'name'               => 'Redux Framework', // The plugin name.
            'slug'               => 'redux-framework-master', // The plugin slug (typically the folder name).
            'required'           => true, // If false, the plugin is only 'recommended' instead of required.
            'external_url'       => 'https://wordpress.org/plugins/redux-framework', // If set, overrides default API URL and points to an external URL.
            'source'             => get_stylesheet_directory() . '/plugins/redux-framework-master.zip',
            'force_activation'   => true,
            'force_deactivation' => true,       
        ),
);
强制激活-->true,将在主题激活时激活reduxframework

“force_deactivation”=>true,当主题处于非活动状态时,将禁用reduxframework

您可以在主题文件夹中添加reduxframework,但当您通过wordpress主题检查来检查主题时,您将得到许多错误

我已经开发了一个主题,下载并检查它将帮助你很多。

在该链接中生成插件激活文件(“class tgm plugin activation.php”将该文件包含到主题文件夹中)下载zip文件

在该文件中“插件数组数组”

添加代码

// add below code to add redux framework plugin

$plugins = array( 
    array(
        'name'               => 'Redux Framework', // The plugin name.
        'slug'               => 'redux-framework', // The plugin slug (typically the folder name).
        'required'           => false, 
        'version'           => '3.6.1',
        'external_url'       => 'https://wordpress.org/plugins/redux-framework', 
        'source'             => 'repo', 
        'force_activation'   => false,
        'force_deactivation' => false,       
    ),
);
在本例中,使用插件路径


'来源'=>'回购',

尝试以下步骤,希望对您有所帮助

步骤1 :

步骤2:解压缩下载的redux框架文件

步骤3:将解压缩文件中的ReduxCore文件夹复制到active theme目录中

步骤4:在当前活动主题目录中创建名为函数的新文件夹

步骤5:将下载的框架文件sample-config.php从示例目录复制到主题函数文件夹

步骤6:将复制的文件从sample-config.php重命名为admin-config.php

步骤7:将此代码复制粘贴到functions.php文件的底部

if( !class_exists('ReduxFramework')){
    require_once(dirname(__FILE__) . '/ReduxCore/Framework.php');
}

if( !isset( $redux_demo ) ){
    require_once( dirname( __FILE__) . '/functions/admin-config.php');
}
步骤8:就这样。现在您可以在主题中看到主题选项。 此外,您还可以根据需要自定义/functions/admin config.php文件


在wordpress主题中包含redux框架的简单方法

    // Including Redux Framework
    require_once (dirname(__FILE__) . '/redux/redux-framework.php');
    if ( class_exists( 'Redux' ) ) {
        require_once (dirname(__FILE__) . '/redux/sample/barebones-config.php');
    }

您是否遵循了此处的说明:或者在上面显示的代码中正确调整了路径?问得好。文档中没有明确说明:Redux确实需要更清晰的文档。他们假设你知道一些刚开始使用Redux的人不会知道的事情<代码>仅下载管理文件夹部分。这将为您提供一个文件夹,您可以将其放置在主题或插件中,并包括~/admin/admin-init.php来初始化它。Ok,太好了。现在你能告诉我在哪里包括admin init.php吗?你看到了吗?可能是所有WordPress框架中最完整的文档?:)@Dovy—它确实是一个很棒的框架,并且在大多数部分都有很好的文档记录。但是缺少了一些非常重要的部分,比如如何(为开发人员)开发。诚然,这很容易理解,但对于初学者来说可能会有所帮助。这里也有同样的问题。这种描述对我来说是不够的。当我尝试打开时,我只看到消息“哎呀!找不到嵌入的东西。在这个位置似乎什么也找不到。也许可以尝试直接访问Redux文档?”所以我现在无法使用它:我只想更改幻灯片文件,这样我就可以使用普通的wp_编辑器而不是普通的文本框。现在我的主题崩溃了><顺便说一句,也许你应该添加一个选项来选择幻灯片编辑器或添加附加字段。谢谢但这是一个真正的惊人plugin@Dovy发电机好像坏了。压缩文件已损坏