[wp-hackers] Exclude page by name in wp_list_pages

Steve Winton stevewinton at gmail.com
Fri Jul 21 13:41:40 GMT 2006


How about:

    $page_row = $wpdb->get_row("SELECT p.ID FROM $wpdb->posts p WHERE
p.post_status = 'static' and p.post_name = '$page_slug' ORDER BY
p.post_date DESC LIMIT 1");

I think the post_name (the slug) is unique, if not then the ORDER BY
p.post_date DESC LIMIT 1 should ensure you only get 1 row returned,
and that it will be the latest page with that slug.

Hope that helps,
Steve

On 7/21/06, Paul Menard <codehooligans at codehooligans.com> wrote:
> So what will be returned if you have two pages with the same title?
>
>
>
> On Jul 20, 2006, at 4:50 AM, Computer Guru wrote:
>
> >> Won't work. Try using $wpdb->get_var, $wpdb->get_results, or one
> >> of the
> >> other $wpdb->get_* functions. Query just returns the number of rows
> >> selected/modified by the query.
> >
> > I stand corrected. I had just searched the codex for DB design and
> > copy and pasted the variables into a standard MySQL query... I had
> > no idea what the query() function even did... ;-)
> >
> > However, the query itself is OK.
> >
> > Computer Guru
> > NeoSmart Technologies
> > http://neosmart.net/blog/
> >
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list