$pagelayer->builder['name'], 'post_status' => 'any', 'include' => (int) $_REQUEST['post'], ]); //print_r($posts); // Did we find it ? if(!empty($posts[0])){ $post = $posts[0]; $_post['id'] = $post->ID; $_post['type'] = get_post_meta($post->ID, 'pagelayer_template_type', true); $_post['conditions'] = get_post_meta( $post->ID, 'pagelayer_template_conditions', true ); $_post['post_title'] = $post->post_title; } } // Fill in defaults if nothing found if(empty($_post)){ $_post['id'] = 0; $_post['type'] = ''; $_post['post_title'] = ''; $_post['conditions'] = []; } ?>
'; if(empty($_post['type'])){ echo __pl('add_temp'); }else{ echo __pl('edit_temp').''.__pl('edit_using').''; } echo '
'; if( !empty($dis_conditions) ){ foreach($dis_conditions as $condi){ echo '
'. __('Display Conditions').' ×
'; $req_arr['id'] = $condi['id']; $req_arr['filter_type'] = 'post'; if( is_numeric(strpos($condi['sub_template'] , 'author'))){ $req_arr['filter_type'] = 'author'; } if( is_numeric(strpos($condi['sub_template'] , 'category')) || is_numeric(strpos($condi['sub_template'] , 'tag')) ){ $req_arr['filter_type'] = 'taxonomy'; } $title_array = pagelayer_builder_get_title($req_arr['filter_type'], $req_arr['id']); $id = ''; $title = ''; foreach ( $title_array as $tmp_id => $tmp_title ) { $id = $tmp_id; $title = $tmp_title; } echo '
'. ((empty($title)) ? __('All') : $title).' ×
'; } } echo '
'. __('Add Conditions').'
'; ?> $ids, 'hide_empty' => false, ]); global $wp_taxonomies; foreach ( $terms as $term ) { $sel_title[ $term->term_taxonomy_id ] = $term->name ; } break; case 'post': $query = new \WP_Query([ 'post_type' => 'any', 'post__in' => $ids, 'posts_per_page' => -1, 'post_status' => 'any', ]); foreach ( $query->posts as $post ) { $sel_title[ $post->ID ] = $post->post_title; } break; case 'author': $query_params = [ 'capability' => array( 'edit_posts' ), 'fields' => ['ID', 'display_name'], 'include' => $ids, ]; // Capability queries were only introduced in WP 5.9. if( version_compare( $GLOBALS['wp_version'], '5.9-alpha', '<' ) ){ $args['who'] = 'authors'; unset( $args['capability'] ); } $user_query = new \WP_User_Query( $query_params ); foreach ( $user_query->get_results() as $author ) { $sel_title[ $author->ID ] = $author->display_name; } break; } return $sel_title; } // Append the Popup templates function pagelayer_builder_popup_append(){ global $pagelayer; if(!empty($GLOBALS['pagelayer_builder_popup_append_called'])){ return; } $GLOBALS['pagelayer_builder_popup_append_called'] = 1; // Render the multiple Popups foreach($pagelayer->template_popup_ids as $id => $priority){ $bLoadString = ''; $content = pagelayer_get_post_content($id); // For popup before loading option // First check that att is placed or not. Then scan and extract the value of id and insert it into bLoadString variable if(strpos($content, 'data-trig_before_load') !== false){ preg_match('#pagelayer-id=([^\s]+)#', $content, $matches); $bLoadString = 'pagelayer-popup-Shown="1" style="display: flex;" pagelayer-popup-id="'.$matches[1].'"'; } echo '
'.$content.'
'; } } // Export Pages, Media and Pagelayer Template Files function pagelayer_builder_export($type){ global $pagelayer; // Load the templates pagelayer_builder_load_templates(); $data['page'] = []; // Load the other posts foreach($pagelayer->settings['post_types'] as $type){ // Make the query $type_query = new WP_Query(['post_type' => $type, 'status' => 'publish', 'posts_per_page' => -1, 'orderby' => 'name', 'order' => 'ASC']); $data[$type] = $type_query->posts; } $nonce = wp_create_nonce('pagelayer_builder'); echo '

Pagelayer - Export Template into a Theme

With this wizard you can export Pagelayer Template(s) (and pages) into a theme folder. This theme folder can be distributed as a theme and can be used by any Pagelayer user.'; // Make two tables echo '

Pagelayer Templates

'; foreach($pagelayer->templates as $k => $v){ $type = get_post_meta($v->ID, 'pagelayer_template_type', true); $dis_conditions = get_post_meta( $v->ID, 'pagelayer_template_conditions', true ); $dis_html = 'None'; if( !empty($dis_conditions) ){ $dis_html = ''; foreach($dis_conditions as $condi){ $dis_html .= ''; if(isset($condi['template'])){ $template = pagelayer_multi_array_search($pagelayer->builder['dispay_on'], $condi['template']); if(is_array($template) && array_key_exists('label', $template)){ $template = $template['label']; } $dis_html .= $template; } if(isset($condi['sub_template'])){ $sub_template = pagelayer_multi_array_search($pagelayer->builder[$condi['template'].'_templates'], $condi['sub_template']); if(is_array($sub_template) && array_key_exists('label', $sub_template)){ $sub_template = $sub_template['label']; } if(!empty($sub_template)){ $dis_html .= ' > '. $sub_template; } } if(!empty($condi['id'])){ $dis_html .= ' > #'. $condi['id']; } $dis_html .= '
'; } } //print_r($v); echo ' '; } echo '
Title Type Display On
'.$v->post_title.' '.(!empty($pagelayer->builder['type'][$type]['label']) ? $pagelayer->builder['type'][$type]['label'] : $pagelayer->builder['type'][$type]).' '.$dis_html.'
'; $pt_objects = get_post_types(['public' => true], 'objects'); foreach($data as $type => $d){ if(empty($pt_objects[$type])){ continue; } echo '

'.$pt_objects[$type]->labels->name.'

'; foreach($data[$type] as $k => $v){ //$type = get_post_meta($v->ID, 'pagelayer_template_type', true); //print_r($v); echo ' '; } echo '
Title Type
'.$v->post_title.' '.$pt_objects[$type]->labels->name.'
'; } echo '
'; }