WordPress.org

Support

Support » How-To and Troubleshooting » Properly Position Category Article Listings

Properly Position Category Article Listings

  • I’m currently formatting my category pages to list all posts, with thumbnail, and a certain amount of space between them. I understand the logic of PHP and CSS, but I’m not very good at either. I’d like to know how to properly position this page, with each article having a set vertical spacing, with the line separating posts between each.

    I essentially want a set vertical height that each post can take up, but I’m not sure how to write the proper CSS for that, and how to apply the class to this bit of php from my category.php page (category-clubs.php at the moment). Here’s the PHP where the posts are being laid out:

    <?php
    		$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    		query_posts("paged=$paged&cat=$cat&orderby=title&order=ASC");
    		?>
    
    		<?php while (have_posts()) : the_post(); ?>
    		<div <?php post_class() ?>>
                    <?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) { the_post_thumbnail(array(260,200), array("class" => "alignleft post_thumbnail")); } ?>
    				<h2 class="title" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    
    				<div class="entry">
    					<?php the_excerpt() ?>
    				</div>
    
    			</div>
    
    		<?php endwhile; ?>

    The first bit is me listing the posts alphabetically, which is probably not done optimally, but that’s all I could find. The while loop itself lists the posts, but is using the_post function as the class, which doesn’t allow me to use my own. Do I wrap all of this in another div? Do I alter the_post function? It’s a pretty simple result I’m looking for, I’m just not sure how to apply it.

    I love explanations, and catch on quick, so any effort to help me here won’t go wasted for future issues 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Properly Position Category Article Listings’ is closed to new replies.