WordPress.org

Support

Support » How-To and Troubleshooting » Sorting Posts Alphabetically

Sorting Posts Alphabetically

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi, so I know I modified the wrong part. I am a programmer but php is not my expertise. Where/how are these methods included from? I don’t see any include functions in my php that contain the method “single_cat_title”, also, how does have_posts() know to only pull back ones of this category? The code that I am concerned about is here:

    <h3><?php single_cat_title(); ?></h3>
    
    <?php while(have_posts()) : the_post(); ?>
    <div class="excerpt">
    			<h2><a href="<?php echo get_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a> </h2>
    
    						<div class="excerptentry"><?php the_excerpt(); ?><div class="excerptlink"><a href="<?php echo get_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"> Click for more information...</a></div></div>
    
    		<div class="postmetadata">
    
    			<span class="date">Posted in <?php the_time('F jS, Y') ?></span>
    
    			<span class="comment"> <?php comments_popup_link('No Comments »','1 Comment »','% Comments »'); ?></span>
    
    			<span class="tag"><?php the_tags('Tags: ', ', ', ''); ?></span>
    
    		</div>
            <div class="clear"></div>
    </div>

    <?php endwhile; ?>`

    Okay, so I found the tutorial on wordpress’s website, and I did not assume it was as easy as

    <?php
     $posts = query_posts($query_string .
    '&orderby=title&order=asc&posts_per_page=10');
    ?>

    How do I have access to change the $posts variable and it magically modifies the query?

    Hi sarcasteak,

    <?php
    $posts = query_posts($query_string .
    ‘&orderby=title&order=asc&posts_per_page=10’);
    ?>

    which file and where this code goes?
    I tried sidebar.php (default theme) and archives.php but it did not work.

    thanks.

    Hi, I placed this before “the loop” used to retrieve posts in my category.php

    the default theme I use does not show any category.php, that’s why I tried in archive.php and then in index.php. But No difference in results.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Sorting Posts Alphabetically’ is closed to new replies.