Querystring for pages (not posts)
-
Hi to all, i hope that someone can help me to understand better the querystring for pages.
I’ve succesfully used the querystring code showed here in the codex:
$querystr = " SELECT * FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON($wpdb->posts.ID = $wpdb->postmeta.post_id) LEFT JOIN $wpdb->term_relationships ON($wpdb->posts.ID = $wpdb->term_relationships.object_id) LEFT JOIN $wpdb->term_taxonomy ON($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) LEFT JOIN $wpdb->terms ON($wpdb->terms.term_id = $wpdb->term_taxonomy.term_id) WHERE $wpdb->terms.name = 'slides' AND $wpdb->term_taxonomy.taxonomy = 'category' AND $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_type = 'post' AND $wpdb->postmeta.meta_key = 'order' ORDER BY $wpdb->postmeta.meta_value ASC ";Ok, that’s for query the posts, but what i would be glad to know is how to obtain the result with a similar code not for posts but for pages.
The following example, got always from the codex page, is working, but not extensively as the previous:$querystr = " SELECT wposts.* FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = 'custom-key' AND wposts.post_type = 'page' ORDER BY wpostmeta.meta_value DESC ";Can someone help me?
Thank you!
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘Querystring for pages (not posts)’ is closed to new replies.