Last active
August 7, 2018 15:50
-
-
Save MohammedKaludi/40344ed8f1a7eba04f0df44a7bfe76e5 to your computer and use it in GitHub Desktop.
Custom Module for AMP Page builder
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 | |
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