• How do I alphabetize posts in two categories on my blog using the Twenty Ten theme? I saw the WordPress Codex has this article on alphabetizing posts. It says:
    Edit your theme’s category.php file, and make the following changes, just before The Loop:

    <?php
    get_header();
    ?>

    <div id=”content”>

    <?php
    // we add this, to show all posts in our
    // Glossary sorted alphabetically
    if (is_category(‘Glossary’))
    {
    $posts = query_posts($query_string .
    ‘&orderby=title&order=asc&posts_per_page=-1’);
    }
    // here comes The Loop!
    if (have_posts()) : while (have_posts()) : the_post(); ?>

    Where do I put that in the Twenty Ten category.php? It goes:

    <?php
    /**
    * The template for displaying Category Archive pages.
    *
    * @package WordPress
    * @subpackage Twenty_Ten
    * @since Twenty Ten 1.0
    */

    get_header(); ?>

    <div id=”container”>
    <div id=”content” role=”main”>

    <h1 class=”page-title”><?php
    printf( __( ‘Category Archives: %s’, ‘twentyten’ ), ‘<span>’ . single_cat_title( ”, false ) . ‘</span>’ );
    ?></h1>

    <?php
    $category_description = category_description();
    if ( ! empty( $category_description ) )
    echo ‘<div class=”archive-meta”>’ . $category_description . ‘</div>’;

    /* Run the loop for the category page to output the posts.
    * If you want to overload this in a child theme then include a file
    * called loop-category.php and that will be used instead.
    */
    get_template_part( ‘loop’, ‘category’ );
    ?>

    </div><!– #content –>
    </div><!– #container –>

    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    Do I have to edit out any lines from the original category.php? Which lines please? What should the coding be?

    I tried using the plugin WP-SNAP! But I couldn’t alphabetize posts using the plugin.

    Please help. Thank you.

  • The topic ‘How to alphabetize posts on Twenty Ten theme?’ is closed to new replies.