WordPress.org

Ready to get started?Download WordPress

Forums

Alphabetical List in Index Template (3 posts)

  1. purephiller
    Member
    Posted 5 years ago #

    I'm trying to get an alphabetical list of my entries in my index template and I read this article:

    http://codex.wordpress.org/Alphabetizing_Posts

    And I read the message board thread that started around the topic as well. When I use the code that is talked about, I get a PHP error. Here's my index template:

    <?php get_header(); ?>
    
    <div id="container">
    	<div id="content" class="narrowcolumn">
    
    <?php if (have_posts()) ; ?>
    <?php while (have_posts()) : the_post(); ?>
    
    <?php
    // we add this, to show *all* posts sorted
    // alphabetically by title
       $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(); ?>
    
    <?php endwhile; ?>
    
    <?php endif; ?>
    
    	</div><!-- END CONTENT -->
    </div><!-- END CONTAINER  -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    And here is the error that it produces:

    Parse error: syntax error, unexpected $end in /home/.handcuffing/pkoberlein/nothingbutphiller.com/inventory/wp-content/themes/Barthelme/index.php on line 25

    Any suggestions?

  2. purephiller
    Member
    Posted 5 years ago #

    I wanted to add that if I remove

    <?php
    // we add this, to show *all* posts sorted
    // alphabetically by title
       $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(); ?>

    everything loads "perfectly". And by perfectly I mean, template loads normally minus any entries.

  3. purephiller
    Member
    Posted 5 years ago #

    *bump*

Topic Closed

This topic has been closed to new replies.

About this Topic