Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MohammedKaludi/80aef3069b66e1d28ba1daee778afb1c to your computer and use it in GitHub Desktop.
Save MohammedKaludi/80aef3069b66e1d28ba1daee778afb1c to your computer and use it in GitHub Desktop.
Custom Controls for AMP For WP plugin
<?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