function tallybuilder_admin_html_editPage() { $tallybuilder_page_id = isset($_GET['tallybuilder_page_id']) ? $_GET['tallybuilder_page_id'] : NULL; ?> <h1 style="margin-bottom:15px;"><?php _e('Edit: ', 'tally-builder'); echo get_the_title($_GET['tallybuilder_page_id']); ?> </h1> <?php do_action('tallybuilder_sections_list_before'); ?> <?php tallybuilder_admin_action_disableSection(); tallybuilder_admin_action_enableSection(); ?> <table class="wp-list-table widefat fixed striped posts" style="margin-top:20px;"> <thead> <tr> <td><?php _e('Sections', 'tally-builder'); ?> </td> <td><?php _e('Actions', 'tally-builder'); ?> </td> <td><?php _e('Description', 'tally-builder'); ?> </td> </tr> </thead> <tbody id="the-list" class="sortable"> <?php wp_reset_postdata(); $tpost_query_args = array('post_type' => 'tally_builder_c', 'posts_per_page' => -1, 'orderby' => 'menu_order', 'order' => 'ASC'); $tpost_query = new WP_Query($tpost_query_args); ?> <?php if ($tpost_query->have_posts()) { ?> <?php while ($tpost_query->have_posts()) { $tpost_query->the_post(); ?> <?php if (get_post_meta(get_the_ID(), 'tallybuilder_parent_page', true) == tallybuilder_post_slug($tallybuilder_page_id)) { ?> <?php $section_edit_url = esc_url(admin_url('post.php?post=' . get_the_ID() . '&action=edit&tallybuilder_page_id=' . $tallybuilder_page_id)); $section_disable_url = esc_url(admin_url('admin.php?page=tallybuilder&action=disable_section§ion_id=' . get_the_ID() . '&tallybuilder_page_id=' . $tallybuilder_page_id . '&view=sections')); $section_enable_url = esc_url(admin_url('admin.php?page=tallybuilder&action=enable_section§ion_id=' . get_the_ID() . '&tallybuilder_page_id=' . $tallybuilder_page_id . '&view=sections')); ?> <tr id="item_<?php the_ID(); ?> "> <td><strong><a href="<?php echo $section_edit_url; ?> "><?php the_title(); ?> </a></strong></td> <td> <a href="<?php echo $section_edit_url; ?> "><?php _e('Edit', 'tally-builder'); ?> </a> | <?php if (get_post_meta(get_the_ID(), 'section_disable', true) == 'yes') { echo 'This Section is currently Disabled <a href="' . $section_enable_url . '">' . __('Enable it', 'tally-builder') . '</a>'; } else { echo '<a href="' . $section_disable_url . '">' . __('Disable', 'tally-builder') . '</a>'; } ?> <?php do_action('tallybuilder_section_action_menu'); ?> </td> <td><?php the_content(); ?> </td> </tr> <?php } ?> <?php } ?> <?php } wp_reset_postdata(); ?> </tbody> </table> <?php do_action('tallybuilder_sections_list_after'); ?> <?php }
function tallybuilder_section_common_metaBox_html($post) { wp_nonce_field(basename(__FILE__), 'tallybuilder_section_common_metaBox_nonce'); $smdata = get_post_meta($post->ID); $tallybuilder_page_id = isset($_GET['tallybuilder_page_id']) ? $_GET['tallybuilder_page_id'] : NULL; ?> <p> <?php $id_name = 'section_type'; $value = ''; if (isset($smdata[$id_name])) { $value = $smdata[$id_name][0]; } $active_it = apply_filters('tallybuilder_active_meta_section_type', false); $disabled = $active_it ? NULL : 'disabled'; $section_items = tallybuilder_registered_sections(); ?> <label style="min-width:150px;display:inline-block; font-weight:bold;vertical-align: top;" for="<?php echo $id_name; ?> "><?php _e('Section Type', 'tally-builder'); ?> </label> <select name="<?php echo $id_name; ?> " id="<?php echo $id_name; ?> " <?php echo $disabled; ?> > <?php if (is_array($section_items)) { ?> <?php foreach ($section_items as $section_name => $section_location) { ?> <option value="<?php echo $section_name; ?> " <?php selected($value, $section_name); ?> rel="#tbSection_<?php echo $section_name; ?> _metabox"><?php echo $section_name; ?> </option> <?php } ?> <?php } ?> </select> </p> <p> <?php $id_name = 'tallybuilder_parent_page'; $value = ''; if (isset($smdata[$id_name])) { $value = $smdata[$id_name][0]; } if ($tallybuilder_page_id != NULL) { $value = tallybuilder_post_slug($tallybuilder_page_id); } ?> <input type="hidden" name="<?php echo $id_name; ?> " id="<?php echo $id_name; ?> " value="<?php echo $value; ?> " /> </p> <?php }
function tallybuilder_metabox_form_post_select($settings = array()) { extract(array_merge(array('meta_id' => '', 'data' => '', 'key' => '', 'title' => '', 'value' => '', 'sanitize' => 'sanitize_text_field', 'p' => 'n', 'post_type' => ''), $settings)); if (isset($data[$key])) { $value = $data[$key]; } if ($sanitize == 'wp_kses') { $value = $sanitize($value, tallybuilder_wp_kses_allowed_html()); } else { $value = $sanitize($value); } $div_id = $meta_id . '__' . $key; $name = $meta_id . '[' . $key . ']'; $pp = false; if ($p == 'y' && !tallybuilder_tc()) { $pp = true; } echo '<div class="tallybuilder_mb_item mb_post_select item-warning-' . $pp . '">'; echo '<label for="' . $name . '">' . $title . '</label>'; if ($pp) { echo '<input type="hidden" name="' . $name . '" id="' . $div_id . '" value="' . $value . '" />'; echo '<span class="robin">Available on Pro Version Only Only</span>'; echo '<select disabled="disabled">'; echo '<option>' . $value . '</option>'; echo '</select>'; } else { echo '<select name="' . $name . '" id="' . $div_id . '" >'; $query_args = array('post_type' => $post_type, 'posts_per_page' => -1); $the_query = new WP_Query($query_args); if ($the_query->have_posts()) { while ($the_query->have_posts()) { $the_query->the_post(); echo '<option value="' . tallybuilder_post_slug(get_the_ID()) . '" ' . selected($value, $the_query->ID, false) . '>' . get_the_title() . '</option>'; } } echo '</select>'; } echo '</div>'; }