ID; $content = get_post_meta ( $amp_current_post_id, 'ampforwp_custom_content_editor', true ); //previous data stored compatible //echo get_post_meta( $amp_current_post_id, 'amp-page-builder', true ); if(get_post_meta($amp_current_post_id ,'use_ampforwp_page_builder',true)==null && get_post_meta( $amp_current_post_id, 'amp-page-builder', true ) != ''){ update_post_meta($amp_current_post_id, 'use_ampforwp_page_builder','yes'); } //Disable page builder if(isset($_GET['ramppb']) && $_GET['ramppb']=='1'){ delete_post_meta($amp_current_post_id, 'use_ampforwp_page_builder','yes'); delete_post_meta($amp_current_post_id, 'ampforwp_page_builder_enable','yes'); } //Enable page builder if(isset($_GET['use_amp_pagebuilder']) && $_GET['use_amp_pagebuilder']=='1'){ update_post_meta($amp_current_post_id, 'use_ampforwp_page_builder','yes'); } if(empty($content)){ echo " "; } call_page_builder(); } /* Add page builder form after editor */ function call_page_builder(){ global $post, $moduleTemplate, $layoutTemplate, $containerCommonSettings; if($post!=null){ $postId = $post->ID; } if(isset($_GET['post_id'])){ $postId = $_GET['post_id']; } add_thickbox(); $previousData = get_post_meta($postId,'amp-page-builder'); $ampforwp_pagebuilder_enable = get_post_meta($postId,'ampforwp_page_builder_enable', true); $previousData = isset($previousData[0])? $previousData[0]: null; $previousData = (str_replace("'", "", $previousData)); $totalRows = 1; $totalmodules = 1; if(!empty($previousData)){ //echo ' sdcds '.json_encode($previousData);die; $jsonData = json_decode($previousData,true); if(count($jsonData['rows'])>0){ $totalRows = $jsonData['totalrows']; $totalmodules = $jsonData['totalmodules']; $previousData = json_encode($jsonData); }else{ $jsonData['rows'] = array(); $jsonData['totalrows']=1; $jsonData['totalmodules'] = 1; $previousData = json_encode($jsonData); } } $pageBuilderData = array( 'title'=>'Pagebuilder Settings', 'default_tab'=> 'customizer', 'tabs' => array( 'customizer'=>'Customizer', 'container_css'=>'Container css' ), 'fields' => array( array( 'type' =>'text', 'name' =>"content_title", 'label' =>'Category Block Title', 'tab' =>'customizer', 'default' =>'Category', ), array( 'type' =>'text', 'name' =>"content_title", 'label' =>'Category Block Title', 'tab' =>'container_css', 'default' =>'Category', ), ) ); $backendRowSetting = $containerCommonSettings; unset($backendRowSetting['front_template_start']); unset($backendRowSetting['front_template_end']); wp_nonce_field( basename( __FILE__) , 'amp_content_editor_nonce' ); //'.add_query_arg('use_amp_pagebuilder','1',$url).' ?>
Start the AMP Page Builder

Start by dragging a Column and then a Module.

1 Column
2 Columns
1 Column 2 Columns
$module) { if(in_array($key, $oldModules)){ continue; } $moduleJson = array('type'=> 'module','moduleDraggable'=>true ,'modulename'=>strtolower($module['name']),'moduleJson'=>$module); echo ' '.$module['label'].' '; } ?>

custom header

array( 'name' => __( 'AMP Layouts' ), 'singular_name' => __( 'AMP Layout' ) ), /*'public' => true, 'has_archive' => false,*/ 'public' => false, // it's not public, it shouldn't have it's own permalink, and so on 'publicly_queriable' => false, // you should be able to query it 'show_ui' => false, // you should be able to edit it in wp-admin 'exclude_from_search' => true, // you should exclude it from search results 'show_in_nav_menus' => false, // you shouldn't be able to add it to menus 'has_archive' => false, // it shouldn't have archive page 'rewrite' => false, // it shouldn't have rewrite rules 'rewrite' => array('slug' => 'amppb-layout'), ) ); } add_action( 'init', 'create_posttype_amppb_layout' ); require_once AMP_PAGE_BUILDER.'functions.php';