[wp-testers] Listing Top Level Pages

Ryan Boren ryan at boren.nu
Wed Jan 24 01:55:56 GMT 2007


On 1/23/07, Charles E. Frees-Melvin <charles.freesmelvin at gmail.com> wrote:
> I was using a plug-in (there used to be 2 differentones to do it) to only
> display the top level pages unless you were viewing the top level page for
> the children pages.
>
> Is there a way to do this in 2.1 as neither of the plugins work.
>
> The plugins I was using were
>
>   *Collapsing Page Menus<http://sporkfancier.com/collapsing-page-menus-plugin>
> * 0.1

Try changing this:

	$pages = $wpdb->get_results("SELECT * " .
		"FROM $wpdb->posts " .
		"WHERE post_status = 'static' AND " .
		"post_parent=$root_id " .
		"ORDER BY $order_by $order_dir");

to this:

	$pages = $wpdb->get_results("SELECT * " .
		"FROM $wpdb->posts " .
		"WHERE post_status = 'publish' AND post_type = 'page' AND " .
		"post_parent=$root_id " .
		"ORDER BY $order_by $order_dir");

>   *Fold Page Menus<http://jpmcc.blogdns.org/index.php/software/fold_page_menus>
> * 1.3
>
> 'Folds' Page menus, i.e. initially only Main Pages are shown in the menu.
> Users can display child Pages by clicking on a parent. Requires a minor edit
> to sidebar.php (see documentation). By John McCreesh<http://jpmcc.blogdns.org/>

Change this:

        $rows = $wpdb->get_results("SELECT ID " .
                "FROM $wpdb->posts " .
                "WHERE (post_status = 'static') AND " .
                $inclusions, ARRAY_N);


to this:

      $rows = $wpdb->get_results("SELECT ID " .
                "FROM $wpdb->posts " .
                "WHERE (post_status = 'publish') AND post_type = 'page' AND " .
                $inclusions, ARRAY_N);


More information about the wp-testers mailing list