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
(@mkyb14)
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
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));
?>
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.