• jennaortiz26

    (@jennaortiz26)


    Hoping someone can help me here. I need to alphabetize this page. I can’t seem to find a solution that works with what I have in place. I’m not great at PHP, so I’m sorry if I’ve missed something.

    This is the code that I have in place now:

    <?php get_header(); ?>
    
        <div id="content" class="col-full">
    		<div id="main" class="col-left box">
    
    			<?php
                    // Get thumbnail variables
                    $thumb_w = get_option('woo_thumb_w');
                    $thumb_h = get_option('woo_thumb_h');
                ?>
    
                   <?php $parent = $post->ID; ?>
    				<?php query_posts('post_type=page&post_parent='.$parent); ?>
    				<?php if (have_posts()) : $count = 0; ?>
    				<?php while (have_posts()) : the_post(); $count++; ?>
    
    				 <!-- Post Starts -->
                    <div <?php post_class(); ?>>
    
                        <?php woo_get_image('image',$thumb_w,$thumb_h,'alignleft thumbnail'); ?>             
    
                        <h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
    
                        <div class="entry">
                            <?php the_excerpt(); ?>
                            <div class="show-link"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"> Full Show Page</a></div>
                        </div><!-- /.entry -->
    
                    </div><!-- /.post -->
    
    			<?php endwhile; else: ?>
    				<div class="post">
                    	<p><?php _e('Sorry, no pages matched your criteria.', 'woothemes') ?></p>
                    </div><!-- /.post -->
                <?php endif; ?>  
    
    				<?php woo_pagenav(); ?>   
    
    		</div><!-- /#main -->
    
            <?php get_sidebar(); ?>
    
        </div><!-- /#content -->
    
    <?php get_footer(); ?>
Viewing 1 replies (of 1 total)
  • Big Bagel

    (@big-bagel)

    Adding the orderby parameter to your query should accomplish that:

    <?php query_posts('post_type=page&orderby=title&post_parent='.$parent); ?>

    It’s just a personal preference, but I always find it more readable to use an array of query parameters rather than a string:

    <?php
    $args = array(
        'post_type' => 'page',
        'orderby' => 'title',
        'post_parent' => $parent
    );
    
    query_posts( $args );
    ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Ordering pages with excerpts in alphabetical order’ is closed to new replies.