Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Here is the kind of archive page I am trying to reproduce for my client:

http://www.catwalkyourself.com/page/ready_to_wear/autumn_winter12-13/rtw12_13.php

As you can see, it is a list of alphabetically organized lists. How would I go about creating this in Wordpress?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I'd use the default Links section in the dashboard, then write a custom loop to sort them alphabetically (and with the rad big letters of the alphabet as headings).

Throw this in your theme's functions.php file, then use it on any page with the [bookmarks] shortcode:

function bookmarks_by_alphabet( ) {

    $letter = ''; // For tracking which letter of the alphabet we're at.
    $args = array(
        'category_name'  => '', // Category name of a category of bookmarks/links to retrieve. Leave this blank to get them all.
        'limit' => -1 // Show all. 
    );
    $output = '';   
    $links = get_bookmarks( $args );
    if ( $links ) {
        foreach ( $links as $link ){

            if ( $link->link_name[0] != $letter ){
                $letter = $link->link_name[0];
                $output .= '<h2>'.$link->link_name[0].'</h2>';
            } 
            $output .= '<a href="'.$link->link_url.'">'.$link->link_name.'</a>'.'<br />';
            //echo '<pre>'.print_r($link, true).'</pre>';
        }
    }

    return $output;
}
add_shortcode('bookmarks', 'bookmarks_by_alphabet');
share|improve this answer
    
thanks Dominic. I am going to try this out –  Amit Erandole Jun 19 '12 at 14:10
1  
You can use it in a custom template like so: echo do_shortcode('[bookmarks]'); –  Dominic Jun 20 '12 at 4:29
    
Thanks a lot for helping out, Dominic –  Amit Erandole Jun 21 '12 at 6:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.