Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

hki429 on "Generating an index of category tags"

$
0
0

Hi,

I'm trying to generate an index of category tags. I'm hoping to achieve the following:

* Return a list of all tags for a category,
* Order this list alphabetically,
* Add single letters between the tags, like you'd see in the index of a book.

For example:

A
- a_tag1
- a_tag2
- a_tag3

B
- B_tag

C
- C_tag

I've searched a lot on the internet (perhaps with wrong keywords), but found here an example for my first step.

Now I use the following:

<ul>
<?php
    query_posts('category_name=mycategory');
    if (have_posts()) : while (have_posts()) : the_post();

        if( get_the_tag_list() ){
            echo $posttags = get_the_tag_list('<li>','</li><li>','</li>');
        }

    endwhile; endif; 

    wp_reset_query();
?>
</ul>

Do you might have an idea how I can achieve my remaining two goals (sort the list alphabetically and add 'book index like' letters)?

Thanks in advance for any insights,


Viewing all articles
Browse latest Browse all 8245

Trending Articles