Title: pages, include only!
Last modified: August 18, 2016

---

# pages, include only!

 *  Resolved [mkyb14](https://wordpress.org/support/users/mkyb14/)
 * (@mkyb14)
 * [19 years, 4 months ago](https://wordpress.org/support/topic/pages-include-only/)
 * I see many posts here about excluding pages etc… I’m wanting to know if there
   is a way to only INCLUDE certian pages, so that i’m not always having to update
   the exclude list.
 * Making it so that only the pages I need as a sidebar have the few pages I want!

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [scormeny](https://wordpress.org/support/users/scormeny/)
 * (@scormeny)
 * [19 years, 4 months ago](https://wordpress.org/support/topic/pages-include-only/#post-479738)
 * If it were my I’d go the poor man’s route and just “hard-code” the html for the
   pages I wanted included, rather than using any fancy wordpress php code.
 * Maybe that’s so obvious you overlooked it, so I just wanted to chime in.
 * Best of luck!
 *  Thread Starter [mkyb14](https://wordpress.org/support/users/mkyb14/)
 * (@mkyb14)
 * [19 years, 4 months ago](https://wordpress.org/support/topic/pages-include-only/#post-479740)
 * true, just wanted to know if there was such a function of wordpress so that eventually
   IF I became motivated that i might actually write a plugin for the installed 
   theme for the sidebar… something simplier that could be installed for everyone
 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [19 years, 4 months ago](https://wordpress.org/support/topic/pages-include-only/#post-479791)
 * scormeny’s solution: +1. But if you really want to, this will do what you want(
   just don’t tell anyone I told you!):
 *     ```
       <?php
       $include = '10,11,12'; // Page IDs to 'include'
       $status = 'post_status = \'static\'';
       $exclude = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE $status AND ID NOT IN ($include)");
       wp_list_pages('exclude=' . implode(',', $exclude));
       ?>
       ```
   
 * **Note for the future:**
    The reason for the extra `$status` line above is because
   with the next major version update to WordPress (probably 2.1), you want to change
   it to this:
 * `$status = 'post_type = \'page\'';`
 * Or, just do this and you’re covered:
 *     ```
       <?php
       $include = '10,11,12'; // Page IDs to 'include'
       $status = ($wp_version < 2.1) ? 'post_status = \'static\'' : 'post_type = \'page\'';
       $exclude = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE $status AND ID NOT IN ($include)");
       wp_list_pages('exclude=' . implode(',', $exclude));
       ?>
       ```
   
 *  [Aaron](https://wordpress.org/support/users/ergate/)
 * (@ergate)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/pages-include-only/#post-480028)
 * The 2.1 version of Kafkaesquis code works with the 2.1 release.
    I have a question
   about it though, is it possible to have that code display the included the subpages
   of that page? Other than just adding the pages physically.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘pages, include only!’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 4 participants
 * Last reply from: [Aaron](https://wordpress.org/support/users/ergate/)
 * Last activity: [19 years, 2 months ago](https://wordpress.org/support/topic/pages-include-only/#post-480028)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
