0

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?

1

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');
  • 1
    You can use it in a custom template like so: echo do_shortcode('[bookmarks]'); – Dominic Jun 20 '12 at 4:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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