Opened 19 years ago
Closed 18 years ago
#1669 closed enhancement (fixed)
Patch to "wp_list_pages" to add the opposite of "exclude" (called "only")
Reported by: | Fryfrog | Owned by: | markjaquith |
---|---|---|---|
Milestone: | 2.1 | Priority: | normal |
Severity: | normal | Version: | 1.5.2 |
Component: | General | Keywords: | exclude, only, opposite bg|has-patch bg|dev-feedback bg|squashed |
Focuses: | Cc: |
Description
The diff below will add the opposite functionality of "exclude" to the wp_list_pages. This means instead of excluding all but 1 page, you can choose to ONLY show that one page. This way, no matter what you add in the future it will never have to be messed with to exclude it.
--- wp-includes/template-functions-post.php.old 2005-09-11 09:02:35.000000000 -0400
+++ wp-includes/template-functions-post.php 2005-09-11 08:56:30.000000000 -0400
@@ -287,6 +287,20 @@
}
}
}
+ if (!empty($ronly?)) {
+ $onlypages = preg_split('/[\s,]+/',$ronly?);
+ if (count($onlypages)) {
+ foreach ($onlypages as $onlypage) {
+ if (!empty($exclusions)) {
+ $exclusions .= ' OR ';
+ } else {
+ $exclusions .= ' AND ';
+ }
+ echo $onlypages[$onlypage];
+ $exclusions .= ' ID = ' . intval($onlypage) . ' ';
+ }
+ }
+ }
$pages = $wpdb->get_results("SELECT * " .
"FROM $wpdb->posts " .
Attachments (1)
Change History (8)
#3
@
19 years ago
- Keywords bg|has-patch bg|dev-feedback added
- Owner changed from anonymous to markjaquith
- Status changed from new to assigned
Thanks! I can't tell you how many people have asked me if this was possible.
#7
@
18 years ago
- Resolution set to fixed
- Status changed from assigned to closed
This ticket is resolved by changeset:3655 that added the ability to include a selected page or pages in function get_pages(). So, with wp_list_pages(), a parameter of 'include=3,4' will present just pages IDs 3 and 4.
Guess it's okay to change this to fixed even though it is assigned to Mark, and request bg's mark as Closed.
Added it into a code block to make its formatting "nicer"