• 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 Post

    B
    Better than other posts
    Boring Post

    C
    Cool Post Name

    etc. 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 ??

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘How to display posts in alphabetical blocks’ is closed to new replies.