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.

I would like to reproduce on Wordpress the same behaviour of mediawiki when it comes to display the posts of a certain category (with an alphabetical order, in columns and using first letters in bold as section titles). Do you think it's possible ?if yes, how would I do that ?

Currently I'm using a wordpress blog as a Laboratory Notebook and would like to add to it the good sides of a wiki. I already have the post revisions but this kind of category view is a plus I would like to add. It's one of the feature that makes me have difficulties to choose between both applications.

Thanks in advance for your help.

share|improve this question
add comment

1 Answer

You can play with Walker to customize output into being split by letters. From there it is matter of CSS to achieve column formatting.

Quick take on Walker:

class Walker_Alphabetized_Category extends Walker_Category {

    var $letter = '';

    function start_el(&$output, $category, $depth, $args) {

        $current_letter = strtoupper(substr($category->name,0,1));

        if( empty($this->letter) ) {

            $this->letter = $current_letter;
            $output .= "<li>{$current_letter}<ul>";
        }
        elseif( $this->letter != $current_letter ) {

            $output .= "</ul></li>";
            $this->letter = $current_letter;
            $output .= "<li>{$current_letter}<ul>";
        }

        parent::start_el(&$output, $category, $depth, $args);
    }
}

echo '<ul>';
wp_list_categories(array(
                    'hierarchical' => false,
                    'orderby' => 'name',
                    'title_li' => '',
                    'walker' => new Walker_Alphabetized_Category(),
                   ));
echo '</ul>';
share|improve this answer
add comment

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.