function preview_sub_element()
    {
        $question_id = $_POST['id'];
        if (!isset($_POST['security']) || !wp_verify_nonce($_POST['security'], 'security') || !current_user_can('edit_posts') || !is_numeric($_POST['id'])) {
            _e('Security check Failed. Contact Administrator.', 'wplms-front-end');
            die;
        }
        ?>
        <?php 
        $post_type = get_post_type($question_id);
        $flag = apply_filters('wplms_front_end_get_question', 1, $question_id);
        // For future purpose
        if ($flag) {
            ?>
            <div class="question_display" id="<?php 
            echo $question_id;
            ?>
">
            <?php 
            $args = apply_filters('preview_question_element', array('p' => $question_id, 'post_type' => $post_type));
            $the_query = new WP_Query($args);
            if ($the_query->have_posts()) {
                while ($the_query->have_posts()) {
                    $the_query->the_post();
                    global $post;
                    the_question();
                }
            }
            wp_reset_postdata();
            $buttons = array(array('label' => __('FULL PREVIEW & STATS', 'vibe'), 'id' => 'preview_element_button', 'href' => get_permalink($question_id), 'type' => 'small_button'), array('label' => __('Close', 'vibe'), 'id' => 'close_element_button', 'type' => 'small_button'));
            foreach ($buttons as $button) {
                WPLMS_Front_End_Fields::generate_fields($button, $question_id);
            }
            ?>
            </div>
        <?php 
        }
        die;
    }
示例#2
0
 function event_taxonomies($field, $taxonomy, $post_type)
 {
     if ($post_type == 'ajde_events') {
         $field = array('label' => __('Event Type', 'wplms-eventon'), 'type' => 'taxonomy', 'taxonomy' => 'event_type', 'from' => 'taxonomy', 'value_type' => 'single', 'style' => '', 'id' => 'event_type_id', 'default' => __('Select Category', 'wplms-eventon'));
         WPLMS_Front_End_Fields::generate_fields($field);
         $field = array('label' => __('Event Location', 'wplms-eventon'), 'type' => 'taxonomy', 'taxonomy' => 'event_location', 'from' => 'taxonomy', 'value_type' => 'single', 'style' => '', 'id' => 'event_location_id', 'default' => __('Select Location', 'wplms-eventon'));
         WPLMS_Front_End_Fields::generate_fields($field);
         $field = array('label' => __('Event Organiser', 'wplms-eventon'), 'type' => 'taxonomy', 'taxonomy' => 'event_organizer', 'from' => 'taxonomy', 'value_type' => 'single', 'style' => '', 'id' => 'event_organizer_id', 'default' => __('Select Event Organiser', 'wplms-eventon'));
     }
     return $field;
 }