/** * Output the view query metabox on the view edit page. * */ function settings_box($post) { // DEPRECATED global $WPV_view_archive_loop; ?> <div id="wpv_view_query_controls" style="position: relative"> <span id="wpv_view_query_controls_over" class="wpv_view_overlay" style="display:none"> <p><strong><?php echo __('The view query settings will be copied from the original', 'wpv-views'); ?> </strong></p> </span> <?php global $wp_version, $pagenow; if (version_compare($wp_version, '3.2', '<')) { echo '<p style="color:red;"><strong>'; _e('* Requires WordPress 3.2 or greater for best results.', 'wpv-views'); echo '</strong></p>'; } $this->include_admin_css(); wp_nonce_field('wpv_get_table_row_ui_nonce', 'wpv_get_table_row_ui_nonce'); ?> <script type="text/javascript"> var wpv_confirm_filter_change = '<?php _e("Are you sure you want to change the filter?\\n\\nIt appears that you made modifications to the filter.", 'wpv-views'); ?> '; <?php if ($pagenow == 'post-new.php') { ?> jQuery(document).ready(function($){ wpv_add_initial_filter_shortcode(); }); <?php } ?> var wpv_save_button_text = '<?php _e("Save View", 'wpv-views'); ?> '; </script> <?php global $WP_Views; $view_settings = $WP_Views->get_view_settings($post->ID); // check for creating a new view for an archive loop. if (isset($_GET['view_archive']) || isset($_GET['view_archive_taxonomy'])) { $view_settings['view-query-mode'] = 'archive'; global $wpv_wp_pointer; $wpv_wp_pointer->add_pointer('View Layout', 'This View displays results for an existing WordPress query.</p><p>Now choose the layout style and then add the fields you wish to display.', 'select[name="_wpv_layout_settings[style]"]', 'bottom', 'wpv_layout'); } ?> <p><span style="font-size:1.1em;font-weight:bold;">Does this View query it's own data or replace a standard WordPress archive?</span> <img src="<?php echo WPV_URL_EMBEDDED; ?> /common/res/images/question.png" style="position:relative;top:2px;" /> <a href="http://wp-types.com/documentation/user-guides/normal-vs-archive-views/" target="_blank"><?php _e('Learn about Normal and Archive Views »', 'wpv-views'); ?> </a></p> <ul style="margin-bottom:10px"> <?php $checked = $view_settings['view-query-mode'] == 'normal' ? 'checked="checked"' : ''; ?> <li><label><input type="radio" name="_wpv_settings[view-query-mode]" value="normal" <?php echo $checked; ?> onclick="jQuery('#wpv-normal-view-mode').show();jQuery('#wpv-archive-view-mode').hide()" /> <?php _e('<strong>Normal View:</strong> This View queries content from the database (good for inserting Views into content or widgets)', 'wpv-views'); ?> </label></li> <?php $checked = $view_settings['view-query-mode'] == 'archive' ? 'checked="checked"' : ''; ?> <li><label><input type="radio" name="_wpv_settings[view-query-mode]" value="archive" <?php echo $checked; ?> onclick="jQuery('#wpv-normal-view-mode').hide();jQuery('#wpv-archive-view-mode').show()" /> <?php _e('<strong>Archive View:</strong> This View displays results for an existing WordPress query (good for archive pages, taxonomy listing, search, etc.)', 'wpv-views'); ?> </label></li> </ul> <div id="wpv-normal-view-mode"<?php if ($view_settings['view-query-mode'] != 'normal') { echo ' style="display:none;"'; } ?> > <table id="wpv_filter_table" class="widefat fixed"> <thead> <tr> <th width="20px"></th> <th width="100%"> <?php _e('Filter', 'wpv-views'); ?>  <a class="wpv-help-link" target="_blank" href="http://wp-types.com/documentation/user-guides/views/"> <?php _e('Querying the database', 'wpv-views'); ?> </a> </th> </tr> </thead> <tbody> <tr id="wpv_filter_type"> <?php wpv_filter_types_admin($view_settings); ?> </tr> <?php global $view_settings_table_row; $view_settings_table_row = 0; do_action('wpv_add_filter_table_row', $view_settings); ?> </tbody> </table> <?php $view_settings = wpv_types_defaults($view_settings); wpv_filter_add_filter_admin($view_settings, null, 'popup_add_filter', '', 'wpv_add_filters', $view_settings['query_type'][0] == 'posts'); wpv_filter_add_filter_admin($view_settings, null, 'popup_add_filter_taxonomy', '', 'wpv_add_filters_taxonomy', $view_settings['query_type'][0] == 'taxonomy'); wpv_filter_controls_admin($view_settings); ?> <p> <span style="font-size:1.1em;font-weight:bold;"><?php _e('Pagination and Sliders settings', 'wpv-views'); ?> </span> <img src="<?php echo WPV_URL_EMBEDDED; ?> /common/res/images/question.png" style="position:relative;top:2px;" /> <a href="http://wp-types.com/documentation/user-guides/views-pagination/" target="_blank"><?php _e('Everything about Views pagination »', 'wpv-views'); ?> </a> </p> <?php wpv_pagination_admin($view_settings); wpv_filter_meta_html_admin($view_settings); ?> </div> <?php $WPV_view_archive_loop->view_edit_admin($post->ID, $view_settings); ?> </div> <?php }
function wpv_filter_types_admin($view_settings) { $view_settings = wpv_types_defaults($view_settings); $view_settings = wpv_post_default_settings($view_settings); $view_settings = wpv_taxonomy_default_settings($view_settings); $view_settings = wpv_order_by_default_settings($view_settings); ?> <td></td> <td> <div id="wpv-filter-type-show"> <?php wpv_get_type_filter_summary($view_settings); ?> </div> <div id="wpv-filter-type-edit" style="background:<?php echo WPV_EDIT_BACKGROUND; ?> ;display:none"> <?php wp_nonce_field('wpv_type_filter_nonce', 'wpv_type_filter_nonce'); ?> <fieldset> <legend style="margin-bottom:5px"><strong><?php _e('Select what content type to load:', 'wpv-views'); ?> </strong></legend> <ul style="padding-left:20px;"> <?php $checked = $view_settings['query_type'][0] == 'posts' ? ' checked="checked"' : ''; ?> <li><label><input type="radio" name="_wpv_settings[query_type][]" value="posts" <?php echo $checked; ?> onclick="wpv_select_post_type_filter()"/> <?php echo __("Posts (This View returns posts)", 'wpv-views'); ?> </label></li> <?php $checked = $view_settings['query_type'][0] == 'taxonomy' ? ' checked="checked"' : ''; ?> <li><label><input type="radio" name="_wpv_settings[query_type][]" value="taxonomy" <?php echo $checked; ?> onclick="wpv_select_taxonomy_type_filter()"/> <?php echo __("Taxonomy (This View returns taxonomies)", 'wpv-views'); ?> </label></li> </ul> <div id="wpv-post-type-checkboxes"<?php if ($view_settings['query_type'][0] != 'posts') { echo ' style="display:none"'; } ?> > <?php wpv_post_types_checkboxes($view_settings); ?> </div> <div id="wpv-taxonomy-radios"<?php if ($view_settings['query_type'][0] != 'taxonomy') { echo ' style="display:none"'; } ?> > <?php wpv_taxonomy_radios($view_settings); ?> </div> </fieldset> <div id="wpv-post-types-settings"<?php if ($view_settings['query_type'][0] != 'posts') { echo ' style="display:none"'; } ?> > <?php wpv_post_types_settings($view_settings); ?> </div> <div id="wpv-post-order-by"<?php if ($view_settings['query_type'][0] != 'posts') { echo ' style="display:none"'; } ?> > <?php wpv_filter_order_by_admin($view_settings); ?> </div> <div id="wpv-post-limit"<?php if ($view_settings['query_type'][0] != 'posts') { echo ' style="display:none"'; } ?> > <?php wpv_filter_limit_admin($view_settings); ?> </div> <div id="wpv-taxonomy-settings"<?php if ($view_settings['query_type'][0] != 'taxonomy') { echo ' style="display:none"'; } ?> > <?php wpv_taxonomy_settings($view_settings); ?> </div> <div id="wpv-taxonomy-order-by"<?php if ($view_settings['query_type'][0] != 'taxonomy') { echo ' style="display:none"'; } ?> > <?php wpv_filter_taxonomy_order_by_admin($view_settings); ?> </div> <div id="wpv-taxonomy-limit"<?php if ($view_settings['query_type'][0] != 'taxonomy') { echo ' style="display:none"'; } ?> > <?php wpv_filter_limit_admin($view_settings, 'taxonomy'); ?> </div> <input class="button-primary" type="button" value="<?php echo __('OK', 'wpv-views'); ?> " name="<?php echo __('OK', 'wpv-views'); ?> " onclick="wpv_show_type_edit_ok()"/> <input class="button-secondary" type="button" value="<?php echo __('Cancel', 'wpv-views'); ?> " name="<?php echo __('Cancel', 'wpv-views'); ?> " onclick="wpv_show_type_edit_cancel()"/> </div> </td> <?php }