Exclude Pages - Version 1.8.1

Version Description

Download this release

Release Info

Developer simonwheatley
Plugin Icon wp plugin Exclude Pages
Version 1.8.1
Comparing to
See all releases

Code changes from version 1.8 to 1.8.1

Files changed (2) hide show
  1. exclude_pages.php +7 -3
  2. readme.txt +20 -10
exclude_pages.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Exclude Pages from Navigation
4
  Plugin URI: http://wordpress.org/extend/plugins/exclude-pages/
5
  Description: Provides a checkbox on the editing page which you can check to exclude pages from the primary navigation. IMPORTANT NOTE: This will remove the pages from any "consumer" side page listings, which may not be limited to your page navigation listings.
6
- Version: 1.8
7
  Author: Simon Wheatley
8
  Author URI: http://simonwheatley.co.uk/wordpress/
9
 
@@ -82,9 +82,13 @@ function ep_exclude_pages( $pages )
82
 
83
  // Recurse down an ancestor chain, checking if one is excluded
84
  // Returns the ID of the "nearest" excluded ancestor
85
- function ep_ancestor_excluded( & $page, & $excluded_ids, & $pages )
86
  {
87
  $parent = & ep_get_page( $page->post_parent, $pages );
 
 
 
 
88
  // Is it excluded?
89
  if ( in_array( $parent->ID, $excluded_ids ) ) {
90
  return $parent->ID;
@@ -96,7 +100,7 @@ function ep_ancestor_excluded( & $page, & $excluded_ids, & $pages )
96
  }
97
 
98
  // Return the portion of the $pages array which refers to the ID passed as $page_id
99
- function ep_get_page( $page_id, & $pages )
100
  {
101
  // PHP 5 would be much nicer here, we could use foreach by reference, ah well.
102
  $length = count($pages);
3
  Plugin Name: Exclude Pages from Navigation
4
  Plugin URI: http://wordpress.org/extend/plugins/exclude-pages/
5
  Description: Provides a checkbox on the editing page which you can check to exclude pages from the primary navigation. IMPORTANT NOTE: This will remove the pages from any "consumer" side page listings, which may not be limited to your page navigation listings.
6
+ Version: 1.8.1
7
  Author: Simon Wheatley
8
  Author URI: http://simonwheatley.co.uk/wordpress/
9
 
82
 
83
  // Recurse down an ancestor chain, checking if one is excluded
84
  // Returns the ID of the "nearest" excluded ancestor
85
+ function ep_ancestor_excluded( $page, $excluded_ids, $pages )
86
  {
87
  $parent = & ep_get_page( $page->post_parent, $pages );
88
+ // Is there a parent?
89
+ if ( ! $parent ) {
90
+ return;
91
+ }
92
  // Is it excluded?
93
  if ( in_array( $parent->ID, $excluded_ids ) ) {
94
  return $parent->ID;
100
  }
101
 
102
  // Return the portion of the $pages array which refers to the ID passed as $page_id
103
+ function ep_get_page( $page_id, $pages )
104
  {
105
  // PHP 5 would be much nicer here, we could use foreach by reference, ah well.
106
  $length = count($pages);
readme.txt CHANGED
@@ -3,16 +3,18 @@ Contributors: simonwheatley
3
  Donate link: http://www.simonwheatley.co.uk/wordpress-plugins/
4
  Tags: get_pages, navigation, menu, exclude pages, hide pages
5
  Requires at least: 2.2.3
6
- Tested up to: 2.8.4
7
- Stable tag: 1.8
8
 
9
- This plugin adds a checkbox, “include this page in menus”, uncheck this to exclude pages from the
10
- page navigation that users see on your site.
11
 
12
  == Description ==
13
 
14
- This plugin adds a checkbox, “include this page in menus”, uncheck this to exclude pages from the
15
- page navigation that users see on your site.
 
 
 
16
 
17
  It is possible to temporarily pause and resume the effect of Exclude Pages by using the new `<?php pause_exclude_pages(); ?>` and `<?php resume_exclude_pages(); ?>` templates tags. The following code will show a list of all pages in your site, even those normally hidden:
18
 
@@ -20,13 +22,13 @@ It is possible to temporarily pause and resume the effect of Exclude Pages by us
20
  <?php wp_list_pages('title_li=<h2>Pages</h2>' ); ?>
21
  <?php resume_exclude_pages(); ?>`
22
 
23
- Other plugin authors: the plugin does not operate on wp_list_pages while the user is on an admin page, if this is an issue you can take advantage of the `ep_admin_bail_out` filter and create a filter function which returns false to allow Exclude Pages to operate in the admin area.
24
 
25
- Any issues: [contact me](http://www.simonwheatley.co.uk/contact-me/).
26
 
27
- === Incompatible With ===
28
 
29
- These plugins and themes don't use the standard WordPress functions to create it's menu, neither does it pass it's list of pages through the get_pages filter. To get them to work you will need to track down the bit of code in the theme/plugin which gets the pages and change it to apply the filter "get_pages" (I cannot be responsible for any unforseen effects of the changes you make, so please test thoroughly). The change to getting pages will probably look something like this:
30
 
31
  `$pages = apply_filters( 'get_pages', $pages );`
32
 
@@ -39,6 +41,14 @@ Exclude pages is incompatible with:
39
 
40
  == Change Log ==
41
 
 
 
 
 
 
 
 
 
42
  = v1.7 2009/7/29 =
43
 
44
  * ENHANCEMENT: You can now turn the Exclude Pages functionality off in the admin area through use of a filter (this is mainly of advantage to other plugin and theme author).
3
  Donate link: http://www.simonwheatley.co.uk/wordpress-plugins/
4
  Tags: get_pages, navigation, menu, exclude pages, hide pages
5
  Requires at least: 2.2.3
6
+ Tested up to: 2.9.2
7
+ Stable tag: 1.8.1
8
 
9
+ This plugin adds a checkbox, “include this page in menus”, uncheck this to exclude pages from the page navigation that users see on your site.
 
10
 
11
  == Description ==
12
 
13
+ This plugin adds a checkbox, “include this page in menus”, uncheck this to exclude pages from the page navigation that users see on your site.
14
+
15
+ Any issues: [contact me](http://www.simonwheatley.co.uk/contact-me/).
16
+
17
+ == Advanced Usage ==
18
 
19
  It is possible to temporarily pause and resume the effect of Exclude Pages by using the new `<?php pause_exclude_pages(); ?>` and `<?php resume_exclude_pages(); ?>` templates tags. The following code will show a list of all pages in your site, even those normally hidden:
20
 
22
  <?php wp_list_pages('title_li=<h2>Pages</h2>' ); ?>
23
  <?php resume_exclude_pages(); ?>`
24
 
25
+ Note to other plugin authors:
26
 
27
+ The plugin does not operate on wp_list_pages while the user is on an admin page, if this is an issue you can take advantage of the `ep_admin_bail_out` filter and create a filter function which returns false to allow Exclude Pages to operate in the admin area.
28
 
29
+ Another note:
30
 
31
+ If your plugins or themes don't use the standard WordPress functions to create their menus then they won't work. To get them to work you will need to track down the bit of code in the theme/plugin which gets the pages and change it to apply the filter "get_pages" (I cannot be responsible for any unforseen effects of the changes you make, so please test thoroughly). The change to getting pages will probably look something like this:
32
 
33
  `$pages = apply_filters( 'get_pages', $pages );`
34
 
41
 
42
  == Change Log ==
43
 
44
+ = v1.8.1 2010/4/19 =
45
+
46
+ * BUGFIX: Check for existence of parent object before attempting to use it. (Thanks to Robert Kosara for the bug report.)
47
+
48
+ = v1.8 2009/10/27 =
49
+
50
+ * BUGFIX: PHP 5.3 doesn't like the fact that parameters marked as passed by reference as passed as value. Params now not marked as passed by ref.
51
+
52
  = v1.7 2009/7/29 =
53
 
54
  * ENHANCEMENT: You can now turn the Exclude Pages functionality off in the admin area through use of a filter (this is mainly of advantage to other plugin and theme author).