Skip to content

Instantly share code, notes, and snippets.

@dovy
Last active February 2, 2018 22:58
Show Gist options
  • Save dovy/4532485517e3b2564d87 to your computer and use it in GitHub Desktop.
Save dovy/4532485517e3b2564d87 to your computer and use it in GitHub Desktop.
<?php
Redux::setSection( $opt_name, array(
'title' => __( 'Text Area', 'redux-framework-demo' ),
'desc' => __( 'For full documentation on this field, visit: ', 'redux-framework-demo' ) . '<a href="http://docs.reduxframework.com/core/fields/textarea/" target="_blank">http://docs.reduxframework.com/core/fields/textarea/</a>',
'id' => 'opt-textarea-subsection',
'subsection' => true,
'fields' => array(
array(
'id' => 'background-parallax',
'type' => 'select',
'title' => __( 'Text Area Field', 'redux-framework-demo' ),
'subtitle' => __( 'Subtitle', 'redux-framework-demo' ),
'desc' => __( 'Field Description', 'redux-framework-demo' ),
'compiler' => true,
'default' => 'Default Text',
),
)
) );
add_filter('redux/options/redux_demo/compiler', 'compiler_action', 10, 3);
function compiler_action($options, $css, $changed_values) {
if (in_array(array('background','header'), $changed_values)) {
//Run compile 1!!!
}
if (in_array(array('footer', 'sidebar'), $changed_values)) {
//Run compile 2!!!
}
$css = '
.top .container {
background-position: '.$options['background-parallax'].';
}
@media (max-width: 600px) {
.container {
background-position: repeat !important;
}
}
@media (max-width: 350px) {
.container {
background-position: fixed;
}
}
';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment