I am developing a WordPress theme with Zurb Foundation 5 framework and ReduxFramework as Theme Options panel. So, there is various way that i can implement Colour Schemes for WordPress theme.
But, I don't want to do this way. ReduxFramework can dynamically change css files and write class or id. And I want to do this way. So i can modify Foundation 5 css style sheet class and id from ReduxFramework Options panel dynamically. And After changing, it's must change Theme colour schemes.
Foundation 5 comes with 6 main colour options. I want to change those from ReduxFramework options panel.
Also is there any way that i can modify or change every options that comes with Foundation 5 CSS framework from Redux Framework.
Please go to this image link. {Open this image in a new tab for bigger view}
https://i.sstatic.net/YI0aD.png
Now question is, How can i do those things ?
I know short of PHP, JS, HTML, CSS, MYSQL etc. If you describe everything in your answer, it's will be more helpful for me.
This Question is RE-POSTED from Unlimited Colour Schemes in wp theme for Foundation 5 - WordPress Development Stack Exchange: . One reputed user suggested me to ask this question here!
The answer given by @Dovy is right in the basics. As far as i know there is no Less version of foundation. So you will need Foundation's Sass (SCSS) files and a SASS (php) compiler.
It seems Redux has a Sass compiler built in too: Redux and Sass
bower install foundation
in your WordPress folder.Now in your Redux config file add a hook on save:
add_action('redux/options/' . $opt_name . '/saved', "compile_sass" );
Also see: https://github.com/reduxframework/redux-framework/issues/533
And finally add the compile_sass
function to the config file (you can use the compile action as an example, see: http://docs.reduxframework.com/core/advanced/integrating-a-compiler/):
function compile_sass($values) {
global $wp_filesystem;
$filename = dirname(__FILE__) . '/style.css';
if( empty( $wp_filesystem ) ) {
require_once( ABSPATH .'/wp-admin/includes/file.php' );
WP_Filesystem();
}
if( $wp_filesystem ) {
require "scssphp/scss.inc.php";
$scss = new scssc();
$scss->setImportPaths("bower_components/foundation/scss/");
// will search for `assets/stylesheets/mixins.scss'
$css = $scss->compile('$primary-color: '.$values['primary-color'].';
@import "foundation.scss"');
$wp_filesystem->put_contents(
$filename,
$css,
FS_CHMOD_FILE // predefined mode settings for WP files
);
}
}