Skip to content

Instantly share code, notes, and snippets.

@MohammedKaludi
Last active August 7, 2018 15:50
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/40344ed8f1a7eba04f0df44a7bfe76e5 to your computer and use it in GitHub Desktop.
Save MohammedKaludi/40344ed8f1a7eba04f0df44a7bfe76e5 to your computer and use it in GitHub Desktop.
Custom Module for AMP Page builder
<?php
add_filter('ampforwp_pagebuilder_modules_filter', 'new_pb_module', 99);
function new_pb_module( $data ){
$data['custom_text_module'] = custom_module_data();
return $data;
}
function custom_module_data(){
$output = '<div class="amp_pb_module amp_text {{css_class}}">
<p>{{text_editor}}</p>
</div>';
return array(
'label' =>'Custom Text Module',
'name' =>'custom_text_module',
'default_tab'=> 'customizer',
'tabs' => array(
'customizer'=>'Customizer',
'container_css'=>'Container css'
),
'fields'=> array(
array(
'type' =>'text-editor',
'name' =>"text_editor",
'label' =>'Content',
'tab' =>'customizer',
'default' =>'Content Goes Here',
'content_type'=>'html'
),
array(
'type' =>'text',
'name' =>"css_class",
'label' =>'Custom CSS Class',
'tab' => "customizer",
'default' =>'Content Goes Here',
'content_type'=>'html'
),
array(
'type' =>'color-picker',
'name' =>"color_picker",
'label' =>'Background color',
'tab' =>'customizer',
'default' =>'',
'content_type'=>'css',
'output_format'=>"color: %default%",
),
),
'front_template'=>$output,
'front_css'=>'',
'front_common_css'=>'',
);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment