Created
April 27, 2017 07:54
-
-
Save MohammedKaludi/80aef3069b66e1d28ba1daee778afb1c to your computer and use it in GitHub Desktop.
Custom Controls for AMP For WP plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( ! function_exists( 'ampforwp_create_custom_controls' ) ) { | |
function ampforwp_create_custom_controls() { | |
$controls[] = array( | |
'id' =>'ampforwp-example-select', | |
'type' => 'switch', | |
'title' => __('Example Select', 'redux-framework-demo'), | |
'default' => 0, | |
'true' => 'Enabled', | |
'false' => 'Disabled', | |
'default' => 0, | |
); | |
$controls[] = array( | |
'id' => 'ampforwp-custom-doubleclick-ad-position-incontent-ad-2', | |
'type' => 'text', | |
'title' => __('Show ad after Paragraphs', 'redux-framework-demo'), | |
'default' => '5', | |
'placeholder' => '5', | |
'required' => array('ampforwp-example-select','=','1'), | |
); | |
return $controls; | |
} | |
} | |
if ( ! function_exists( 'ampforwp_custom_section' ) ) { | |
function ampforwp_custom_section($sections){ | |
$sections[] = array( | |
'title' => __('Advanced Section', 'redux-framework-demo'), | |
'icon' => 'el el-th-large', | |
'desc' => 'Custom Desctiption ', | |
'fields' => ampforwp_create_custom_controls(), | |
); | |
return $sections; | |
} | |
} | |
add_filter("redux/options/redux_builder_amp/sections", 'ampforwp_custom_section'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment