/** * Render Template Regions metabox. * * @since 1.0.0 * @access public * @param object $post */ public function render_template_regions($post) { // Add an nonce field so we can check for it later. wp_nonce_field('tf_template_option_custom_box', 'tf_template_option_custom_box_nonce'); $fields = array('template_part_caption' => array('type' => 'separator', 'meta' => array('html' => sprintf(__('<h4>Select a <a href="%s">Template Part</a> for each region: Header, Sidebar, and Footer.</h4>', 'themify-flow'), admin_url('edit.php?post_type=tf_template_part')))), 'tf_template_region_header' => array('type' => 'template_part_select', 'label' => __('Header', 'themify-flow'), 'show_extra_link' => false), 'tf_template_region_sidebar' => array('type' => 'template_part_select', 'label' => __('Sidebar', 'themify-flow'), 'show_extra_link' => false), 'tf_template_region_footer' => array('type' => 'template_part_select', 'label' => __('Footer', 'themify-flow'), 'show_extra_link' => false)); $data = TF_Model::get_field_exist_values($fields, $post->ID); /* not used anymore if ( count( $data ) > 0 ) { foreach( $data as $key => $shortcode ) { preg_match('/.*slug="(.*)"/i', $shortcode, $slug ); $data[ $key ] = isset( $slug[1] ) ? $slug[1] : ''; } }*/ echo '<div class="tf_interface">'; echo TF_Form::render($fields, $data); echo '</div>'; }
/** * Render Template Options metabox. * * @since 1.0.0 * @access public * @param object $post */ public function render_template_part_option($post) { // Add an nonce field so we can check for it later. wp_nonce_field('tf_template_part_option_custom_box', 'tf_template_part_option_custom_box_nonce'); $fields = $this->fields(); unset($fields['tf_template_part_name']); $data = TF_Model::get_field_exist_values($fields, $post->ID); echo '<div class="tf_interface">'; echo TF_Form::render($fields, $data); echo '</div>'; }