Embedding Redux version = '3.1.8.18'; into a CHILD THEME
Hi Dovy,
I'm using your redux-framework again in my new big project..
Just notice about the new sample-config file on __construct method.
public function __construct() {
if ( !class_exists("ReduxFramework" ) ) {
return;
}
// This is needed. Bah WordPress bugs. ;)
if ( defined('TEMPLATEPATH') && strpos( Redux_Helpers::cleanFilePath( __FILE__ ), Redux_Helpers::cleanFilePath( TEMPLATEPATH ) ) !== false) {
$this->initSettings();
} else {
add_action('plugins_loaded', array($this, 'initSettings'), 10);
}
//$this->initSettings();
}
there seems to be a problem on this line not loading the Options on admin section
if ( defined('TEMPLATEPATH') && strpos( Redux_Helpers::cleanFilePath( __FILE__ ), Redux_Helpers::cleanFilePath( TEMPLATEPATH ) ) !== false) {
$this->initSettings();
}
I am using a child theme ;) maybe that's the issue? or am I missing something?
it will only show if I disable the If/else line and add $this->initSettings(); below the if/else line.
I'm just curious about that line, I don't want to mess most of the defaults code.. ;)
Cheers Kenn
Looks like you may have solved the child theme issue. Probably due to template path being off for the given theme. You're welcome to alter that to make it work. Please let us know what does work on both ends. ;)
I'll take a look at it next week if you can't figure it out. We're busy preparing for the webinar. ;)
I'm just playing around it for awhile
surely this method would make it work easily
public function __construct() {
if ( !class_exists("ReduxFramework" ) ) {
return;
}
$this->initSettings();
}
but I don't want to get rid of the if/else line so I just change the defined value
public function __construct() {
if ( !class_exists("ReduxFramework" ) ) {
return;
}
// This is needed. Bah WordPress bugs. ;)
if ( defined( 'CMK_DIR' ) && strpos( Redux_Helpers::cleanFilePath( __FILE__ ), Redux_Helpers::cleanFilePath( CMK_DIR ) ) !== false) {
$this->initSettings();
} else {
add_action('plugins_loaded', array($this, 'initSettings'), 10);
}
}
then just define CMK_DIR globaly inside my child theme
define( 'CMK_DIR', get_stylesheet_directory());
I have tested the redux plugin that also uses my child theme (without redux) and the Sample Options from the plugin would display, but manually embedding it on my child theme won't simply work.. lol.. not really sure why.. Well, anyway. I supposed those who manually embed redux into a theme should have knowledge about this. so I don't think its really a big deal. ;)
Where are you embedding Redux? In the parent theme, or the child theme? Where is your config file, in the parent theme, or the child theme? This problem seems to arise when they are installed separate from each other, and I've not been able to get anyone with this issue to tell me how they have it set up. So...please, please tell me. :)
Yea. The real question is are you trying to override the parent theme settings file or just get it to run. ;)
Thanks for the response
I actually never mess with the main theme framework.
The parent is genesis. Never Touch it and is up-to-date ;)
I created a child theme
with a basic structure
folder - > my-theme-name file ------> functions.php file ------> style.css
I put everything inside my child theme.
Just so you know, I have been using Redux in my 4 previous Genesis Child Theme,
but with the latest update of the redux sample config in __construct method, that has if/else statement, the sample Options wouldn't simply display after requiring redux framework.php and sample-config.php unless I will Change TEMPLATEPATH into my own defined constant.
I think I have a better idea. I am going to add a static value within Redux for the path to the Framework file.
We'll then use that as the base that the sample config tests against.
Can you Skype me? DovyDigital
Just to test it again, I try creating a very2 basic genesis child theme with only 2 file and only few lines of code.
folder structure.
------test ---------redux -----------ReduxCore -----------sample ------functions.php ------style.css
then in functions.php
require_once(get_template_directory().'/lib/init.php');
define( 'CHILD_THEME_NAME', 'TEST' );
define( 'CHILD_THEME_URL', 'http://localhost/test' );
add_theme_support('html5');
require_once(get_stylesheet_directory().'/redux/ReduxCore/framework.php');
require_once(get_stylesheet_directory().'/redux/sample/sample-config.php');
in style.css
/*
Theme Name: TEST
Description: BLA BLAH BLAH
Theme URI: http://localhost/
Author: SilverKenn
Author URI: http://localhost/cmk
Version: 1.0.1
Tags: there you go.
Template: genesis
Template Version: 2.0.2
License: WTFPL
License URI: http://wtfpl.org/
*/
@import url('.././genesis/style.css');
unfortunately, Sample Options won't show by default. :)
Now it's working.
Thanks for the update dovy,
unfortunately, there seems to be a wordpress bug with get_stylesheet_directory() in windows.
I have tested the new update you have made but still doesn't work on my localhost (since I am using windows)
just to clarify
$r = Redux_Helpers::cleanFilePath( __FILE__ );
$s = get_stylesheet_directory();
print_r($r."<br/>".$s);
output are different;
F:/xampp/htdocs/wp/gantry/wp-content/themes/cmk/config/admin/cmk-admin-config.php
F:\xampp\htdocs\wp\gantry/wp-content/themes/cmk
so i change the config file line 26 to
if ( strpos( Redux_Helpers::cleanFilePath( __FILE__ ), Redux_Helpers::cleanFilePath(get_stylesheet_directory()) ) !== false)
I guess you have to update the core again.. lol. Thanks anyway,
Cheers
Just change
$s = get_stylesheet_directory();
to
$s = Redux_Helpers::cleanFilePath( get_stylesheet_directory() );
Fixed and pushed.
Thanks