Simply Exclude - Version 2.0.5

Version Description

2012-05-16 More tweaks to the widget exclude logic and cleanup logic on main query vs extra query.

Download this release

Release Info

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

Code changes from version 2.0.4 to 2.0.5

Files changed (2) hide show
  1. readme.txt +5 -1
  2. simplyexclude.php +15 -21
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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.4
8
 
9
  == Description ==
10
 
@@ -48,6 +48,10 @@ At the time (version 1.6.1) the plugin only effects Pages included in the tradit
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.
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.4Beta2
8
 
9
  == Description ==
10
 
48
 
49
  == Changelog ==
50
 
51
+ = 2.0.5 =
52
+ 2012-05-16
53
+ More tweaks to the widget exclude logic and cleanup logic on main query vs extra query.
54
+
55
  = 2.0.4 =
56
  2012-05-16
57
  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.
simplyexclude.php CHANGED
@@ -2,9 +2,9 @@
2
  /*
3
  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.4
8
  Author URI: http://www.codehooligans.com
9
 
10
  Revision history
@@ -22,8 +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
- 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,7 +60,7 @@ class 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') );
@@ -708,7 +708,7 @@ class SimplyExclude
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>
@@ -743,7 +743,7 @@ class SimplyExclude
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>
@@ -2036,18 +2036,12 @@ class SimplyExclude
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)
@@ -2056,12 +2050,9 @@ class SimplyExclude
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
 
@@ -2167,9 +2158,12 @@ class SimplyExclude
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
  }
2174
 
2175
 
2
  /*
3
  Plugin Name: Simply Exclude
4
  Plugin URI: http://www.codehooligans.com/projects/wordpress/simply-exclude/
5
+ Description: Provides an interface to selectively exclude/include all Taxonomies, Post Types and Users from the 4 actions used by WordPress. is_front, is_archive, is_search, is_feed. Also provides access to some of the common widgets user like tag cloud and categories listings.
6
  Author: Paul Menard
7
+ Version: 2.0.5
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.0.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
+ 2.0.5 - 2012-05-17 More tweaks to the widget exclude logic and cleanup logic on main query vs extra query.
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') );
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('Query Filtering', SIMPLY_EXCLUDE_I18N_DOMAIN) ?></th>
712
  </tr>
713
  </thead>
714
  <tbody>
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('Query Filtering', SIMPLY_EXCLUDE_I18N_DOMAIN) ?></th>
747
  </tr>
748
  </thead>
749
  <tbody>
2036
  $se_debug = false;
2037
 
2038
  // Normally we only want to handle the main page loop. But sometimes...
2039
+ $is_main_query_loop = false;
2040
 
2041
+ global $wp_the_query;
2042
+ if ($wp_the_query === $query)
2043
+ $is_main_query_loop = true;
 
2044
 
 
 
 
 
 
2045
  if ( $se_debug == true ) {
2046
 
2047
  if ($is_main_query_loop == true)
2050
  echo "is_main_query_loop=[false]<br />";
2051
  }
2052
 
 
 
 
2053
  if (isset($query->query_vars['post_type'])) {
2054
 
2055
+ if (array_search($query->query_vars['post_type'], $this->se_post_types_exclude) !== false)
2056
  return $query;
2057
  }
2058
 
2158
  {
2159
  $query_post_types = array($query_post_types);
2160
  }
2161
+
2162
  if ( $se_debug == true ) {
2163
  echo "query_post_types<pre>"; print_r($query_post_types); echo "</pre>";
2164
  echo "post_types_array<pre>"; print_r($post_types_array); echo "</pre>";
2165
+ echo "post__not_in<pre>"; print_r($post__not_in); echo "</pre>";
2166
+ echo "post__in<pre>"; print_r($post__in); echo "</pre>";
2167
  }
2168
 
2169