.amp_pb{display: inline-block;width: 100%;} .row{display: inline-flex;width: 100%;} .col-2{width:50%;float:left;} .amp_blurb{text-align:center} .amp_blurb amp-img{margin: 0 auto;} .amp_btn{text-align:center} .amp_btn a{background: #f92c8b;color: #fff;padding: 9px 20px;border-radius: 3px;display: inline-block;box-shadow: 1px 1px 4px #ccc;} ID; if(is_home() && $redux_builder_amp['ampforwp-homepage-on-off-support']==1 && ampforwp_get_blog_details() == false){ $postId = $redux_builder_amp['amp-frontpage-select-option-pages']; } $previousData = get_post_meta($postId,'amp-page-builder'); $previousData = isset($previousData[0])? $previousData[0]: null; $ampforwp_pagebuilder_enable = get_post_meta($postId,'ampforwp_page_builder_enable', true); if($previousData!="" && $ampforwp_pagebuilder_enable=='yes'){ $previousData = (str_replace("'", "", $previousData)); $previousData = json_decode($previousData,true); if(count($previousData['rows'])>0){ foreach ($previousData['rows'] as $key => $rowsData) { $container = $rowsData['cell_data']; if(count($container)>0){ foreach($container as $contentArray){ echo $moduleTemplate[$contentArray['type']]['front_css']; }//foreach content closed }//ic container check closed }//foreach closed }//if closed count($previousData['rows'])>0 }//If Closed $previousData!="" && $ampforwp_pagebuilder_enable=='yes' } function amppb_post_content($content){ global $post, $redux_builder_amp, $containerCommonSettings; $postId = $post->ID; if(is_home() && $redux_builder_amp['ampforwp-homepage-on-off-support']==1 && ampforwp_get_blog_details() == false){ $postId = $redux_builder_amp['amp-frontpage-select-option-pages']; } $previousData = get_post_meta($postId,'amp-page-builder'); $previousData = isset($previousData[0])? $previousData[0]: null; $ampforwp_pagebuilder_enable = get_post_meta($postId,'ampforwp_page_builder_enable', true); if($previousData!="" && $ampforwp_pagebuilder_enable=='yes'){ $html =""; $previousData = (str_replace("'", "", $previousData)); $previousData = json_decode($previousData,true); //Call Sorting for rows if(count($previousData['rows'])>0){ $html = '
'; $previousData = sortByIndex($previousData['rows']); //rander its html foreach ($previousData as $key => $rowsData) { $customClass = ''; $rowStartTemplate = $containerCommonSettings['front_template_start']; $rowEndTemplate = $containerCommonSettings['front_template_end']; foreach ($containerCommonSettings['fields'] as $key => $field) { if(isset($rowsData['data'][$field['name']])){ $replace = $rowsData['data'][$field['name']]; }else{ $replace = ''; } $customClass = str_replace('{{'.$field['name'].'}}', $replace, $rowStartTemplate); } $html .= $customClass; //$html .= '
'; if(count($rowsData['cell_data'])>0){ switch ($rowsData['cells']) { case '1': $html .= rowData($rowsData['cell_data'],$rowsData['cells']); break; case '2': $colData = array(); foreach($rowsData['cell_data'] as $colDevider){ $colData[$colDevider['cell_container']][] = $colDevider; } foreach($colData as $data) $html .= rowData($data,$rowsData['cells']); break; default: # code... break; } } $html .= $rowEndTemplate; } $html .= '
'; } if(!empty($html)){ $content = $html; } } return $content; } function rowData($container,$col){ global $moduleTemplate; $ampforwp_show_excerpt = true; $html = ''; if(count($container)>0){ $html .= "
"; //sort modules by index $container = sortByIndex($container); if(count($container)>0){ foreach($container as $contentArray){ $moduleFrontHtml = $moduleTemplate[$contentArray['type']]['front_template']; $moduleName = $moduleTemplate[$contentArray['type']]['name']; switch($moduleName){ case 'gallery_image': $moduleDetails = $moduleTemplate[$contentArray['type']]; $moduleFrontHtml = pagebuilderGetGalleryFrontendView($moduleDetails,$contentArray); break; case 'contents': $fieldValues = array(); foreach($moduleTemplate[$contentArray['type']]['fields'] as $key => $field){ $fieldValues[$field['name']]= $contentArray[$field['name']]; } $args = array( 'cat' => $fieldValues['category_selection'], 'posts_per_page' => $fieldValues['show_total_posts'], 'has_password' => false, 'post_status'=> 'publish' ); //The Query $the_query = new WP_Query( $args ); $totalLoopHtml = contentHtml($the_query,$fieldValues); $moduleFrontHtml = str_replace('{{content_title}}', urldecode($fieldValues['content_title']), $moduleFrontHtml); $moduleFrontHtml = str_replace('{{category_selection}}', $totalLoopHtml, $moduleFrontHtml); /* Restore original Post Data */ wp_reset_postdata(); break; default: if(isset($moduleTemplate[$contentArray['type']]['fields']) && count($moduleTemplate[$contentArray['type']]['fields']) > 0) { foreach ($moduleTemplate[$contentArray['type']]['fields'] as $key => $field) { if(isset($contentArray[$field['name']]) && !empty($contentArray)){ $moduleFrontHtml = str_replace('{{'.$field['name'].'}}', urldecode($contentArray[$field['name']]), $moduleFrontHtml); }else{ $moduleFrontHtml = str_replace('{{'.$field['name'].'}}', "", $moduleFrontHtml); } } } break; } $html .= $moduleFrontHtml; /*if($contentArray['type']=="text"){ $html .= "

".$contentArray['value']."

"; }else{ $html .= $contentArray['value']; }*/ } } $html .= "
"; } return $html; } function ampforwp_pagebuilder_module_style(){ echo $redux_builder_amp['css_editor']; } function sortByIndex($contentArray){ $completeSortedArray = array(); if(count($contentArray)>0){ foreach ($contentArray as $key => $singleContent) { $completeSortedArray[$singleContent['index']] = $singleContent; } ksort($completeSortedArray); return $completeSortedArray; }else{ return $contentArray; } }