3

如何在 Theme wordpress 中包含 Redux Framework?

此代码不起作用:

<?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' );
  }
?>
4

6 回答 6

2

剧透警报,这里是 Redux 的首席开发人员。您可以使用 Redux Generator 来获取管理文件夹并绕过一些痛苦。

http://generate.reduxframework.com

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

于 2014-04-20T06:17:32.987 回答
1

对于我的作品:

    // 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 结束示例文件夹...检查代码... 照片

于 2014-03-11T07:59:55.660 回答
1

在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 插件 --> http://tgmpluginactivation.com/

在您的主题函数中包含 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,       
        ),
);

force_activation--> true ,当你的主题激活时将激活 reduxframework 。

'force_deactivation' => true,当您的主题停用时,将停用 reduxframework。

你可以在主题文件夹中添加reduxframework,但是当你通过wordpress主题检查主题时,你会得到很多错误。

我已经开发了一个主题,下载并检查它会对你有很大帮助。 http://www.nxcreation.com/alpha-nx-one/

于 2015-02-16T19:01:00.287 回答
1

试试这些步骤希望有帮助

第 1 步下载 Redux 框架

第 2 步:提取/解压缩下载的 redux 框架文件。

第 3 步:将ReduxCore文件夹从提取/解压缩文件复制到您的活动主题目录中。

第 4 步:在您当前的活动主题目录中创建名为functions的新文件夹

第 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文件。

参考链接

于 2017-03-07T21:36:25.657 回答
0

在 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');
    }
于 2017-08-08T12:05:36.713 回答
0

在该链接http://tgmpluginactivation.com/download/生成插件激活文件(“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,       
    ),
);

在此用于插件路径

'来源' => '回购',

于 2016-09-15T13:45:09.790 回答