Support » Fixing WordPress » Sort By with the_post_thumbnail

  • Hi all,

    I have a category page which displays a post title and featured image (with the_post_thumbnail code) I’m trying to assort the posts within it by descending name. Is there a simple way to do this? Below is my category page code.

     * The template for displaying Category Archive pages.
     * @package Toolbox
     * @since Toolbox 0.1
    get_header(); ?>
    		<section id="primary">
    			<div id="content" class="product_gallery" role="main">
    			<h1 class="cat_title"><?php single_cat_title(); ?></h1>
    			<?php while ( have_posts() ) : the_post(); ?>
    			<div class="product_thumbnail">
    			<a href="<?php the_permalink() ?>">
    			<?php //the_post_thumbnail grabs the post's "featured image" this feature has added theme support in the child theme functions.php ?>
    			<?php the_post_thumbnail('thumbnail', array('class' => 'thumbnail')); ?>
    			<?php //This piece of code figures out the corrosponding post_title of the featured image ?>
    			<p class="post_caption"><?php echo get_post(get_post_thumbnail_id())->post_title; ?></p>
    			</div> <!-- product_thumbnail -->
    					// If comments are open or we have at least one comment, load up the comment template
    					if ( comments_open() || '0' != get_comments_number() )
    						comments_template( '', true );
    			<?php endwhile; // end of the loop. ?>
    			<br class="clear" />
    			</div><!-- #content -->
    		</section><!-- #primary -->
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Sort By with the_post_thumbnail’ is closed to new replies.