[wp-hackers] Question about parameters to wp() function

Peter Westwood peter.westwood at ftwr.co.uk
Thu Nov 9 08:45:19 GMT 2006


On Wed, November 8, 2006 9:40 pm, Paul Menard wrote:
> This past summer I hacked into edit-pages.php and admin-functions.php
> (the page_rows() function), WP version 2.0.2 and 2.0.4. The site had
> more then 3000 total pages that were defined into 8 nested levels.
> The default loading of the edit pages window took something like 3-5
> minutes depending on server load.
>
> So I made some code changes to display Tier I (post_parent=0) items
> first. If any of these items contains sub-items I would make the
> post_title display as a link and pass that page ID as the parent. So
> when the page reloads I pulled the parent page id from the _GET vars
> and display the tier items whose parent is the previous page posts.
> I'm sure you get the idea. I couldn't figure out a way to do this via
> a plugin so a hacking I went.
>
> Finally my question:
> Now I'm playing with the latest SVN trunk, WP version 2.1alpha3. I
> see some major changes in edit-pages.php and admin-functions.php. I
> just trying to see if my hack functionality will still work. In my
> original implementation I wrote some custom queries to pull in the
> values I needed. Now in the SVN version I'd like to use as much of
> the 'infrastructure' code that is provided. One function I'm trying
> to track down is wp(). This is called at the top of edit-pages.php to
> load the items for display. I've traced this into query.php to the
> function get_posts(). What I'm scratching my head about is how can I
> pass a parameter to filter the parent or child_of? Something like the
> get_pages() parameter 'child_of'.
>

You would need to add a child_of query arg using the relavent api and then
add a where clause to the query using the releavent filter.

The following plugin I wrote to allow child_of query's within page
templates  provides this functionality :
http://blog.ftwr.co.uk/wordpress/query-child-of-page/

westi
-- 
Peter Westwood <peter.westwood at ftwr.co.uk>
http://blog.ftwr.co.uk


More information about the wp-hackers mailing list