Simply Exclude - Version 2.0.4

Version Description

2012-05-16 Added new Settings option to allow control of filtering the main page WPQuery only or all WPQuery requests. Added exclusion for common post_types. General bug fixed for reported issues where filter was either not occurring or that filter was causing a blank page or missing navigation.

Download this release

Release Info

Developer pmenard
Plugin Icon wp plugin Simply Exclude
Version 2.0.4
Comparing to
See all releases

Code changes from version 2.0.3 to 2.0.4

Files changed (2) hide show
  1. readme.txt +5 -2
  2. simplyexclude.php +182 -27
readme.txt CHANGED
@@ -4,13 +4,12 @@ Donate link: http://www.codehooligans.com
4
  Tags: admin, posts, pages, categories, tags, Post Type, Taxonomy, exclude, include, is_front, is_archive, is_search, is_feed, is_author
5
  Requires at least: 3.2
6
  Tested up to: 3.3.1
7
- Stable tag: 2.0.3
8
 
9
  == Description ==
10
 
11
  Note to all used who tried the version 2.0 and 2.0.1 there were was bugs in the logic which upgrades the previous version of the Simply Exclude configuration to the version 2.0 format. If you lost your settings you can now reload them manually. Simply go into simply Exclude > Settings and at the very bottom is an option to reload the configuration again.
12
 
13
-
14
  Provides an interface to selectively exclude/include Post Types, Taxonomies and Authors 4 actions used by WordPress
15
 
16
  is_front - When the user views the Front page.
@@ -49,6 +48,10 @@ At the time (version 1.6.1) the plugin only effects Pages included in the tradit
49
 
50
  == Changelog ==
51
 
 
 
 
 
52
  = 2.0.3 =
53
  2012-03-18
54
  Fixes to core filtering logic.
4
  Tags: admin, posts, pages, categories, tags, Post Type, Taxonomy, exclude, include, is_front, is_archive, is_search, is_feed, is_author
5
  Requires at least: 3.2
6
  Tested up to: 3.3.1
7
+ Stable tag: 2.0.4
8
 
9
  == Description ==
10
 
11
  Note to all used who tried the version 2.0 and 2.0.1 there were was bugs in the logic which upgrades the previous version of the Simply Exclude configuration to the version 2.0 format. If you lost your settings you can now reload them manually. Simply go into simply Exclude > Settings and at the very bottom is an option to reload the configuration again.
12
 
 
13
  Provides an interface to selectively exclude/include Post Types, Taxonomies and Authors 4 actions used by WordPress
14
 
15
  is_front - When the user views the Front page.
48
 
49
  == Changelog ==
50
 
51
+ = 2.0.4 =
52
+ 2012-05-16
53
+ Added new Settings option to allow control of filtering the main page WPQuery only or all WPQuery requests. Added exclusion for common post_types. General bug fixed for reported issues where filter was either not occurring or that filter was causing a blank page or missing navigation.
54
+
55
  = 2.0.3 =
56
  2012-03-18
57
  Fixes to core filtering logic.
simplyexclude.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Simply Exclude
4
  Plugin URI: http://www.codehooligans.com/projects/wordpress/simply-exclude/
5
  Description: Provides an interface to selectively exclude/include categories, tags and page from the 4 actions used by WordPress. is_front, is_archive, is_search, is_feed.
6
  Author: Paul Menard
7
- Version: 2.0.3
8
  Author URI: http://www.codehooligans.com
9
 
10
  Revision history
@@ -22,6 +22,8 @@ Revision history
22
  2.0.1 - 2012-03-04 Small bug. On the new Simply Exclude Help panel I user the jQuery UI Accordion package. Seems I failed to check this when setting the minimum WordPress version I was supporting (3.2). Seems jQuery UI Accordion is not available in core WordPress until version 3.3. So have added my own libraries to cover the older versions of WordPress. Sorry about that. And thanks to @biswajeet for bringing this up in the WordPress forums.
23
  2.0.2 - 2012-03-05 Fixed some issues when converting from the previous version of the Simply Exclude configurations.
24
  2.0.3 - 2012-03-18 Fixes to core filtering logic.
 
 
25
  */
26
 
27
  define('SIMPLY_EXCLUDE_I18N_DOMAIN', 'simplyexclude');
@@ -58,7 +60,7 @@ class SimplyExclude
58
  $this->page_hooks = array();
59
 
60
  /* Setup the tetdomain for i18n language handling see http://codex.wordpress.org/Function_Reference/load_plugin_textdomain */
61
- load_plugin_textdomain( SIMPLY_EXCLUDE_I18N_DOMAIN, false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
62
 
63
  add_action( 'init', array(&$this,'init_proc') );
64
  add_action( 'admin_init', array(&$this,'admin_init_proc') );
@@ -649,6 +651,120 @@ class SimplyExclude
649
 
650
 
651
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
652
  /****************************************************************************************************************************/
653
  /* */
654
  /* COLUMNS (HEADERS) */
@@ -1130,6 +1246,9 @@ class SimplyExclude
1130
  else if ($this->se_cfg['data']['taxonomies'][$t_item->name]['options']['showhide'] == "no")
1131
  $this->se_cfg['data']['taxonomies'][$t_item->name]['options']['showhide'] = 'hide';
1132
 
 
 
 
1133
  $this->se_cfg['data']['taxonomies'][$t_item->name]['options']['hierarchical'] = $t_item->hierarchical;
1134
 
1135
  }
@@ -1157,6 +1276,7 @@ class SimplyExclude
1157
 
1158
  if (!isset($this->se_cfg['data']['post_types'][$t_item->name]['options']['active']))
1159
  $this->se_cfg['data']['post_types'][$t_item->name]['options']['active'] = 'yes';
 
1160
  if (!isset($this->se_cfg['data']['post_types'][$t_item->name]['options']['showhide']))
1161
  $this->se_cfg['data']['post_types'][$t_item->name]['options']['showhide'] = 'show';
1162
 
@@ -1165,6 +1285,9 @@ class SimplyExclude
1165
  else if ($this->se_cfg['data']['post_types'][$t_item->name]['options']['showhide'] == "no")
1166
  $this->se_cfg['data']['post_types'][$t_item->name]['options']['showhide'] = 'hide';
1167
 
 
 
 
1168
  $this->se_cfg['data']['post_types'][$t_item->name]['options']['capability_type'] = $t_item->capability_type;
1169
  }
1170
  }
@@ -1197,6 +1320,9 @@ class SimplyExclude
1197
  $this->se_cfg['data']['se_types'][$t_item['name']]['options']['showhide'] = 'show';
1198
  else if ($this->se_cfg['data']['se_types'][$t_item['name']]['options']['showhide'] == "no")
1199
  $this->se_cfg['data']['se_types'][$t_item['name']]['options']['showhide'] = 'hide';
 
 
 
1200
  }
1201
  }
1202
 
@@ -1900,33 +2026,48 @@ class SimplyExclude
1900
  global $wp_version;
1901
 
1902
  // We don't process filtering for admin. ever!
1903
- if (is_admin())
1904
  return $query;
1905
-
1906
- if ( version_compare( $wp_version, '3.3.0', '<' ) ) {
1907
-
 
 
 
 
 
 
 
 
1908
  global $wp_the_query;
1909
- return $wp_the_query === $query;
1910
- return $query;
1911
 
1912
  } else {
1913
  if (!is_main_query())
1914
- return $query;
1915
  }
1916
-
1917
-
1918
- // Ignore all queries from within wp-admin.
1919
- if ($query->is_admin)
 
 
 
 
 
 
1920
  return $query;
1921
 
 
 
 
 
 
 
 
1922
  $this->se_load_config();
1923
 
1924
- // Check our debug
1925
- if (isset($_GET['SE_DEBUG']))
1926
- $se_debug = true;
1927
- else
1928
- $se_debug = false;
1929
-
1930
 
1931
  $action_data = array();
1932
 
@@ -1948,7 +2089,7 @@ class SimplyExclude
1948
  $action_data = $this->se_get_action_data('is_archive');
1949
  }
1950
 
1951
- if (( current_user_can('manage_options') ) && ( $se_debug == true ) ){
1952
  echo "action_data<pre>"; print_r($action_data); echo "</pre>";
1953
  }
1954
 
@@ -1963,6 +2104,9 @@ class SimplyExclude
1963
  {
1964
  foreach($key_data as $key_key => $key_key_data)
1965
  {
 
 
 
1966
  $tax_args = array(
1967
  'taxonomy' => $key_key,
1968
  'field' => 'id',
@@ -1989,8 +2133,12 @@ class SimplyExclude
1989
  $post__in = array();
1990
  $post__not_in = array();
1991
  $post__all = array();
 
1992
  foreach($key_data as $key_key => $key_key_data)
1993
  {
 
 
 
1994
  if ($key_key_data['actions'] == 'e') {
1995
  $post__not_in = array_merge($post__not_in, $key_key_data['terms']);
1996
  $post_types_array['__not_in'][] = $key_key;
@@ -2019,7 +2167,7 @@ class SimplyExclude
2019
  {
2020
  $query_post_types = array($query_post_types);
2021
  }
2022
- if (( current_user_can('manage_options') ) && ( $se_debug == true ) ){
2023
  echo "query_post_types<pre>"; print_r($query_post_types); echo "</pre>";
2024
  echo "post_types_array<pre>"; print_r($post_types_array); echo "</pre>";
2025
  }
@@ -2029,7 +2177,7 @@ class SimplyExclude
2029
  {
2030
  $query->set('post__not_in', $post__not_in);
2031
 
2032
- if (( current_user_can('manage_options') ) && ( $se_debug == true ) ){
2033
 
2034
  echo "PROCESSING: POST__NOT_IN<br />";
2035
  echo "post__not_in<pre>"; print_r($post__not_in); echo "</pre>";
@@ -2044,7 +2192,7 @@ class SimplyExclude
2044
  $merged_query_post_types = array_unique(array_merge($post_types_array['__in'], $query_post_types));
2045
  $query->set('post_type', $merged_query_post_types);
2046
  }
2047
- if (( current_user_can('manage_options') ) && ( $se_debug == true ) ){
2048
  echo "PROCESSING: POST__IN<br />";
2049
  echo "post__in<pre>"; print_r($post__in); echo "</pre>";
2050
  echo "merged_query_post_types<pre>"; print_r($merged_query_post_types); echo "</pre>";
@@ -2054,7 +2202,7 @@ class SimplyExclude
2054
  {
2055
  $merged_query_post_types = array_unique(array_merge($post_types_array['all'], $query_post_types));
2056
 
2057
- if (( current_user_can('manage_options') ) && ( $se_debug == true ) ){
2058
  echo "post_types_array[all]<pre>"; print_r($post_types_array['all']); echo "</pre>";
2059
  echo "merged_query_post_types<pre>"; print_r($merged_query_post_types); echo "</pre>";
2060
  }
@@ -2065,6 +2213,9 @@ class SimplyExclude
2065
  {
2066
  foreach($key_data as $key_key => $key_key_data)
2067
  {
 
 
 
2068
  if ($key_key == "users")
2069
  {
2070
  $user_ids = $this->se_listify_ids($key_key_data['terms'], $key_key_data['actions']);
@@ -2072,7 +2223,7 @@ class SimplyExclude
2072
  {
2073
  $query->set('author', $user_ids);
2074
 
2075
- if (( current_user_can('manage_options') ) && ( $se_debug == true ) ){
2076
  echo "user_ids=[". $user_ids ."]<br />";
2077
  }
2078
  }
@@ -2087,12 +2238,12 @@ class SimplyExclude
2087
  else
2088
  $tax_query['relation'] = "AND";
2089
 
2090
- if (( current_user_can('manage_options') ) && ( $se_debug == true ) ){
2091
  echo "tax_query<pre>"; print_r($tax_query); echo "</pre>";
2092
  }
2093
  $query->set('tax_query', $tax_query);
2094
  }
2095
- if (( current_user_can('manage_options') ) && ( $se_debug == true ) ){
2096
  echo "query<pre>"; print_r($query); echo "</pre>";
2097
  }
2098
  }
@@ -2700,6 +2851,7 @@ class SimplyExclude
2700
  $this->se_show_taxonomy_active_panel($taxonomy->name);
2701
  $this->se_show_taxonomy_actions_panel($taxonomy->name);
2702
  $this->se_show_taxonomy_showhide_panel($taxonomy->name);
 
2703
  }
2704
  }
2705
  }
@@ -2716,6 +2868,8 @@ class SimplyExclude
2716
  $this->se_show_post_type_active_panel($post_type->name);
2717
  $this->se_show_post_type_actions_panel($post_type->name);
2718
  $this->se_show_post_type_showhide_panel($post_type->name);
 
 
2719
  }
2720
  }
2721
  }
@@ -2727,6 +2881,7 @@ class SimplyExclude
2727
  $this->se_show_se_type_active_panel('users');
2728
  $this->se_show_se_type_actions_panel('users');
2729
  $this->se_show_se_type_showhide_panel('users');
 
2730
  }
2731
 
2732
  function se_display_configuration_reload_actions_panel() {
4
  Plugin URI: http://www.codehooligans.com/projects/wordpress/simply-exclude/
5
  Description: Provides an interface to selectively exclude/include categories, tags and page from the 4 actions used by WordPress. is_front, is_archive, is_search, is_feed.
6
  Author: Paul Menard
7
+ Version: 2.0.4
8
  Author URI: http://www.codehooligans.com
9
 
10
  Revision history
22
  2.0.1 - 2012-03-04 Small bug. On the new Simply Exclude Help panel I user the jQuery UI Accordion package. Seems I failed to check this when setting the minimum WordPress version I was supporting (3.2). Seems jQuery UI Accordion is not available in core WordPress until version 3.3. So have added my own libraries to cover the older versions of WordPress. Sorry about that. And thanks to @biswajeet for bringing this up in the WordPress forums.
23
  2.0.2 - 2012-03-05 Fixed some issues when converting from the previous version of the Simply Exclude configurations.
24
  2.0.3 - 2012-03-18 Fixes to core filtering logic.
25
+ 2.9.4 - 2012-05-16 Added new Settings option to allow control of filtering the main page WPQuery only or all WPQuery requests. Added exclusion for common post_types. General bug fixed for reported issues where filter was either not occurring or that filter was causing a blank page or missing navigation.
26
+
27
  */
28
 
29
  define('SIMPLY_EXCLUDE_I18N_DOMAIN', 'simplyexclude');
60
  $this->page_hooks = array();
61
 
62
  /* Setup the tetdomain for i18n language handling see http://codex.wordpress.org/Function_Reference/load_plugin_textdomain */
63
+ load_plugin_textdomain( SIMPLY_EXCLUDE_I18N_DOMAIN, false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
64
 
65
  add_action( 'init', array(&$this,'init_proc') );
66
  add_action( 'admin_init', array(&$this,'admin_init_proc') );
651
 
652
 
653
 
654
+
655
+
656
+ /****************************************************************************************************************************/
657
+ /* */
658
+ /* QUERY OVERRIDE PANELS */
659
+ /* */
660
+ /****************************************************************************************************************************/
661
+
662
+ function se_show_taxonomy_query_override_panel($taxonomy)
663
+ {
664
+ if (!$taxonomy) return;
665
+
666
+ if (!isset($this->se_cfg['data']['taxonomies'][$taxonomy]))
667
+ return;
668
+
669
+ $this->current_taxonomy = $this->se_cfg['data']['taxonomies'][$taxonomy];
670
+
671
+
672
+ ?>
673
+ <table class="widefat simply-exclude-settings-postbox simplyexclude-active-panel" cellpadding="3" cellspacing="3" border="0">
674
+ <thead>
675
+ <tr>
676
+ <th class="action" colspan="2"><?php _e('Query Filtering', SIMPLY_EXCLUDE_I18N_DOMAIN) ?></th>
677
+ </tr>
678
+ </thead>
679
+ <tbody>
680
+ <tr>
681
+ <td class="description">
682
+ <p><?php _e("Override query filtering for Main Loop Only or All Loops?", SIMPLY_EXCLUDE_I18N_DOMAIN) ?></p>
683
+ <p><?php _e("The Simply-Exclude plugin was designed to only work with the main page query. But sometimes other plugins or your theme will effect how the main filtering works. So if you are having trouble attempting to filter categories from your home page you might want to try and set this option to 'All' and see if it corrects your issue.", SIMPLY_EXCLUDE_I18N_DOMAIN); ?></p>
684
+ </td>
685
+ <td class="inc-excl">
686
+ <input type="radio" name="se_cfg[<?php echo $taxonomy; ?>][options][qover]" value="main"
687
+ <?php if ($this->current_taxonomy['options']['qover'] == 'main')
688
+ echo "checked='checked'"; ?> /> <?php _e('Main Loop Only', SIMPLY_EXCLUDE_I18N_DOMAIN); ?><br />
689
+ <input type="radio" name="se_cfg[<?php echo $taxonomy; ?>][options][qover]" value="all"
690
+ <?php if ($this->current_taxonomy['options']['qover'] == 'all')
691
+ echo "checked='checked'"; ?> /> <?php _e('All Loops', SIMPLY_EXCLUDE_I18N_DOMAIN); ?>
692
+ </td>
693
+ </tr>
694
+ </table>
695
+ <?php
696
+ }
697
+
698
+ function se_show_post_type_query_override_panel($post_type)
699
+ {
700
+ if (!$post_type) return;
701
+
702
+ if (!isset($this->se_cfg['data']['post_types'][$post_type]))
703
+ return;
704
+
705
+ $this->current_post_type = $this->se_cfg['data']['post_types'][$post_type];
706
+
707
+ ?>
708
+ <table class="widefat simply-exclude-settings-postbox simplyexclude-active-panel" cellpadding="3" cellspacing="3" border="0">
709
+ <thead>
710
+ <tr>
711
+ <th class="action" colspan="2"><?php _e('Show/Hide', SIMPLY_EXCLUDE_I18N_DOMAIN) ?></th>
712
+ </tr>
713
+ </thead>
714
+ <tbody>
715
+ <tr>
716
+ <td class="description">
717
+ <p><?php _e("Override query filtering for Main Loop Only or All Loops?", SIMPLY_EXCLUDE_I18N_DOMAIN) ?></p>
718
+ <p><?php _e("The Simply-Exclude plugin was designed to only work with the main page query. But sometimes other plugins or your theme will effect how the main filtering works. So if you are having trouble attempting to filter categories from your home page you might want to try and set this option to 'All' and see if it corrects your issue.", SIMPLY_EXCLUDE_I18N_DOMAIN); ?></p>
719
+ </td>
720
+ <td class="inc-excl">
721
+ <input type="radio" name="se_cfg[<?php echo $post_type; ?>][options][qover]" value="main"
722
+ <?php if ($this->current_post_type['options']['qover'] == 'main')
723
+ echo "checked='checked'"; ?> /> <?php _e('Main Loop Only', SIMPLY_EXCLUDE_I18N_DOMAIN); ?><br />
724
+ <input type="radio" name="se_cfg[<?php echo $post_type; ?>][options][qover]" value="all"
725
+ <?php if ($this->current_post_type['options']['qover'] == 'all')
726
+ echo "checked='checked'"; ?> /> <?php _e('All Loops', SIMPLY_EXCLUDE_I18N_DOMAIN); ?>
727
+ </td>
728
+ </tr>
729
+ </table>
730
+ <?php
731
+ }
732
+
733
+ function se_show_se_type_query_override_panel($se_type)
734
+ {
735
+ if (!$se_type) return;
736
+
737
+ if (!isset($this->se_cfg['data']['se_types'][$se_type]))
738
+ return;
739
+
740
+ $this->current_se_type = $this->se_cfg['data']['se_types'][$se_type];
741
+
742
+ ?>
743
+ <table class="widefat simply-exclude-settings-postbox simplyexclude-active-panel" cellpadding="3" cellspacing="3" border="0">
744
+ <thead>
745
+ <tr>
746
+ <th class="action" colspan="2"><?php _e('Show/Hide', SIMPLY_EXCLUDE_I18N_DOMAIN) ?></th>
747
+ </tr>
748
+ </thead>
749
+ <tbody>
750
+ <tr>
751
+ <td class="description">
752
+ <p><?php _e("Override query filtering for Main Loop Only or All Loops?", SIMPLY_EXCLUDE_I18N_DOMAIN) ?></p>
753
+ <p><?php _e("The Simply-Exclude plugin was designed to only work with the main page query. But sometimes other plugins or your theme will effect how the main filtering works. So if you are having trouble attempting to filter categories from your home page you might want to try and set this option to 'All' and see if it corrects your issue.", SIMPLY_EXCLUDE_I18N_DOMAIN); ?></p>
754
+ </td>
755
+ <td class="inc-excl">
756
+ <input type="radio" name="se_cfg[<?php echo $se_type; ?>][options][qover]" value="main"
757
+ <?php if ($this->current_se_type['options']['qover'] == 'main')
758
+ echo "checked='checked'"; ?> /> <?php _e('Main Loop Only', SIMPLY_EXCLUDE_I18N_DOMAIN); ?><br />
759
+ <input type="radio" name="se_cfg[<?php echo $se_type; ?>][options][qover]" value="all"
760
+ <?php if ($this->current_se_type['options']['qover'] == 'all')
761
+ echo "checked='checked'"; ?> /> <?php _e('All Loops', SIMPLY_EXCLUDE_I18N_DOMAIN); ?>
762
+ </td>
763
+ </tr>
764
+ </table>
765
+ <?php
766
+ }
767
+
768
  /****************************************************************************************************************************/
769
  /* */
770
  /* COLUMNS (HEADERS) */
1246
  else if ($this->se_cfg['data']['taxonomies'][$t_item->name]['options']['showhide'] == "no")
1247
  $this->se_cfg['data']['taxonomies'][$t_item->name]['options']['showhide'] = 'hide';
1248
 
1249
+ if (!isset($this->se_cfg['data']['taxonomies'][$t_item->name]['options']['qover']))
1250
+ $this->se_cfg['data']['taxonomies'][$t_item->name]['options']['qover'] = 'main';
1251
+
1252
  $this->se_cfg['data']['taxonomies'][$t_item->name]['options']['hierarchical'] = $t_item->hierarchical;
1253
 
1254
  }
1276
 
1277
  if (!isset($this->se_cfg['data']['post_types'][$t_item->name]['options']['active']))
1278
  $this->se_cfg['data']['post_types'][$t_item->name]['options']['active'] = 'yes';
1279
+
1280
  if (!isset($this->se_cfg['data']['post_types'][$t_item->name]['options']['showhide']))
1281
  $this->se_cfg['data']['post_types'][$t_item->name]['options']['showhide'] = 'show';
1282
 
1285
  else if ($this->se_cfg['data']['post_types'][$t_item->name]['options']['showhide'] == "no")
1286
  $this->se_cfg['data']['post_types'][$t_item->name]['options']['showhide'] = 'hide';
1287
 
1288
+ if (!isset($this->se_cfg['data']['post_types'][$t_item->name]['options']['qover']))
1289
+ $this->se_cfg['data']['post_types'][$t_item->name]['options']['qover'] = 'main';
1290
+
1291
  $this->se_cfg['data']['post_types'][$t_item->name]['options']['capability_type'] = $t_item->capability_type;
1292
  }
1293
  }
1320
  $this->se_cfg['data']['se_types'][$t_item['name']]['options']['showhide'] = 'show';
1321
  else if ($this->se_cfg['data']['se_types'][$t_item['name']]['options']['showhide'] == "no")
1322
  $this->se_cfg['data']['se_types'][$t_item['name']]['options']['showhide'] = 'hide';
1323
+
1324
+ if (!isset($this->se_cfg['data']['se_types'][$t_item['name']]['options']['qover']))
1325
+ $this->se_cfg['data']['se_types'][$t_item['name']]['options']['qover'] = 'main';
1326
  }
1327
  }
1328
 
2026
  global $wp_version;
2027
 
2028
  // We don't process filtering for admin. ever!
2029
+ if ((is_admin()) || ($query->is_admin))
2030
  return $query;
2031
+
2032
+ // Check our debug
2033
+ if (( current_user_can('manage_options') ) && (isset($_GET['SE_DEBUG'])))
2034
+ $se_debug = true;
2035
+ else
2036
+ $se_debug = false;
2037
+
2038
+ // Normally we only want to handle the main page loop. But sometimes...
2039
+ $is_main_query_loop = true;
2040
+
2041
+ if (!function_exists('is_main_query')) {
2042
  global $wp_the_query;
2043
+ if ($wp_the_query !== $query)
2044
+ $is_main_query_loop = false;
2045
 
2046
  } else {
2047
  if (!is_main_query())
2048
+ $is_main_query_loop = false;
2049
  }
2050
+
2051
+ if ( $se_debug == true ) {
2052
+
2053
+ if ($is_main_query_loop == true)
2054
+ echo "is_main_query_loop=[true]<br />";
2055
+ else
2056
+ echo "is_main_query_loop=[false]<br />";
2057
+ }
2058
+
2059
+ if ($is_main_query_loop != true)
2060
  return $query;
2061
 
2062
+ if (isset($query->query_vars['post_type'])) {
2063
+
2064
+ if (array_Search($query->query_vars['post_type'], $this->se_post_types_exclude) !== false)
2065
+ return $query;
2066
+ }
2067
+
2068
+
2069
  $this->se_load_config();
2070
 
 
 
 
 
 
 
2071
 
2072
  $action_data = array();
2073
 
2089
  $action_data = $this->se_get_action_data('is_archive');
2090
  }
2091
 
2092
+ if ( $se_debug == true ) {
2093
  echo "action_data<pre>"; print_r($action_data); echo "</pre>";
2094
  }
2095
 
2104
  {
2105
  foreach($key_data as $key_key => $key_key_data)
2106
  {
2107
+ if (($is_main_query_loop == false) && ($this->se_cfg['data']['taxonomies'][$key_key]['options']['qover'] == "main"))
2108
+ continue;
2109
+
2110
  $tax_args = array(
2111
  'taxonomy' => $key_key,
2112
  'field' => 'id',
2133
  $post__in = array();
2134
  $post__not_in = array();
2135
  $post__all = array();
2136
+
2137
  foreach($key_data as $key_key => $key_key_data)
2138
  {
2139
+ if (($is_main_query_loop == false) && ($this->se_cfg['data']['post_types'][$key_key]['options']['qover'] == "main"))
2140
+ continue;
2141
+
2142
  if ($key_key_data['actions'] == 'e') {
2143
  $post__not_in = array_merge($post__not_in, $key_key_data['terms']);
2144
  $post_types_array['__not_in'][] = $key_key;
2167
  {
2168
  $query_post_types = array($query_post_types);
2169
  }
2170
+ if ( $se_debug == true ) {
2171
  echo "query_post_types<pre>"; print_r($query_post_types); echo "</pre>";
2172
  echo "post_types_array<pre>"; print_r($post_types_array); echo "</pre>";
2173
  }
2177
  {
2178
  $query->set('post__not_in', $post__not_in);
2179
 
2180
+ if ( $se_debug == true ) {
2181
 
2182
  echo "PROCESSING: POST__NOT_IN<br />";
2183
  echo "post__not_in<pre>"; print_r($post__not_in); echo "</pre>";
2192
  $merged_query_post_types = array_unique(array_merge($post_types_array['__in'], $query_post_types));
2193
  $query->set('post_type', $merged_query_post_types);
2194
  }
2195
+ if ( $se_debug == true ) {
2196
  echo "PROCESSING: POST__IN<br />";
2197
  echo "post__in<pre>"; print_r($post__in); echo "</pre>";
2198
  echo "merged_query_post_types<pre>"; print_r($merged_query_post_types); echo "</pre>";
2202
  {
2203
  $merged_query_post_types = array_unique(array_merge($post_types_array['all'], $query_post_types));
2204
 
2205
+ if ( $se_debug == true ) {
2206
  echo "post_types_array[all]<pre>"; print_r($post_types_array['all']); echo "</pre>";
2207
  echo "merged_query_post_types<pre>"; print_r($merged_query_post_types); echo "</pre>";
2208
  }
2213
  {
2214
  foreach($key_data as $key_key => $key_key_data)
2215
  {
2216
+ if (($is_main_query_loop == false) && ($this->se_cfg['data']['se_types'][$key_key]['options']['qover'] == "main"))
2217
+ continue;
2218
+
2219
  if ($key_key == "users")
2220
  {
2221
  $user_ids = $this->se_listify_ids($key_key_data['terms'], $key_key_data['actions']);
2223
  {
2224
  $query->set('author', $user_ids);
2225
 
2226
+ if ( $se_debug == true ) {
2227
  echo "user_ids=[". $user_ids ."]<br />";
2228
  }
2229
  }
2238
  else
2239
  $tax_query['relation'] = "AND";
2240
 
2241
+ if ( $se_debug == true ) {
2242
  echo "tax_query<pre>"; print_r($tax_query); echo "</pre>";
2243
  }
2244
  $query->set('tax_query', $tax_query);
2245
  }
2246
+ if ( $se_debug == true ) {
2247
  echo "query<pre>"; print_r($query); echo "</pre>";
2248
  }
2249
  }
2851
  $this->se_show_taxonomy_active_panel($taxonomy->name);
2852
  $this->se_show_taxonomy_actions_panel($taxonomy->name);
2853
  $this->se_show_taxonomy_showhide_panel($taxonomy->name);
2854
+ $this->se_show_taxonomy_query_override_panel($taxonomy->name);
2855
  }
2856
  }
2857
  }
2868
  $this->se_show_post_type_active_panel($post_type->name);
2869
  $this->se_show_post_type_actions_panel($post_type->name);
2870
  $this->se_show_post_type_showhide_panel($post_type->name);
2871
+ $this->se_show_post_type_query_override_panel($post_type->name);
2872
+
2873
  }
2874
  }
2875
  }
2881
  $this->se_show_se_type_active_panel('users');
2882
  $this->se_show_se_type_actions_panel('users');
2883
  $this->se_show_se_type_showhide_panel('users');
2884
+ $this->se_show_se_type_query_override_panel('users');
2885
  }
2886
 
2887
  function se_display_configuration_reload_actions_panel() {