How to display posts in alphabetical blocks
-
Hi,
I want to display posts in alphabetical blocks using 1 custom loop, for example…
A
A Post Name
Another Post Name
A Name of A PostB
Better than other posts
Boring PostC
Cool Post Nameetc. etc.
I already have the custom query, but just need help to section them out, can anyone help me??
Here is my custom query…
$querystr = "SELECT distinct wposts.*
FROM $wpdb->posts wposts
LEFT JOIN $wpdb->postmeta wpostmeta ON wposts.ID = wpostmeta.post_id
LEFT JOIN $wpdb->term_relationships ON (wposts.ID = $wpdb->term_relationships.object_id)
LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)
WHERE $wpdb->term_taxonomy.taxonomy = 'category'
AND wpostmeta.meta_key = 'Name'
AND $wpdb->term_taxonomy.term_id IN(7641)
ORDER BY wpostmeta.meta_value ASC";
$pageposts = $wpdb->get_results($querystr, OBJECT);
Thanks in advance ??
- The topic ‘How to display posts in alphabetical blocks’ is closed to new replies.