Listing wordpress pages with descriptions

Whilst building this site I wanted to implement wordpress in a way which didn't make the site stand out as mainly being a blog. This approach led me to set up a number of static pages and I wanted to have an index of these pages for the projects page which would automatically update as I added new projects. Currently wordpress provides a function to list the titlesĀ  of all static pages, as links, using the wplistpages() method, however I wanted each page to be listed with a description, a task for which wordpress doesn't provide a function so to solve this I wrote my own script which queried the appropriate bits of the database and made the page I wanted:

First I created a new php page template which would act as the index page.

Then I wrote a SQL query which extracts all the pages which are set as children of the index page (this requires that all pages you wish to appear in the index are set as children of the page).

$querystr = "SELECT $wpdb->posts.* FROM $wpdb->posts WHERE $wpdb->posts.poststatus = 'publish' AND $wpdb->posts.posttype = 'page' AND $wpdb->posts.postparent = '68' ORDER BY $wpdb->posts.posttitle ASC";
Then executed the query. Now the appropriate data has been retrieved all that remains is to loop through it and process it and add it to the page:
<h3><a title="Permanent Link to &lt;?php thetitle(); ?&gt;" href="&lt;?php thepermalink() ?&gt;"></a></h3>
To add the description to each page I used a custom field when adding each page, in this case I called it "des". Custom fields are stored as a multi dimensional array named $customfields in each post from which the appropriate field can be retrieved:
$mycustomfield = $customfields['des']; <?php echo '<div id="des">'.$mycustomfield[0].'</div>';
Now the page can be completed by adding any footer or sidebar required and added to the site as normal as a new blank page using the page just created as a template.

The whole script can be downloaded here.