Revision: 31222
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 1, 2010 11:14 by dallasbpeters
Initial Code
<?php query_posts('post_type=slashies&posts_per_page=3'); ?>
<?php $count = 0; ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php
$extra_class = "";
if($count % 3 == 0){
$extra_class = "alpha";
}elseif($count % 3 == 2){
$extra_class = "omega";
}
?>
<div class="grid_3 partner <?php echo $extra_class ?>">
<?php if ( has_post_thumbnail()) the_post_thumbnail('220-square'); ?>
<h3><?php the_title();?></h3>
<?php the_content(); ?>
<?php if ( get_post_meta($post->ID, 'partner-website', true) ) : ?>
<p></p><a href="<?php echo get_post_meta($post->ID, 'partner-website', true) ?>" title="<?php the_title();?>" target="_blank" rel="bookmark">Visit Partner Website</a></p>
<?php endif; ?><!-- end link check -->
</div>
<?php $count++ ?>
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
<?php wp_reset_query(); ?>
Initial URL
Initial Description
Used this on the vox site to find a custom post type and then assign a variable to get different classes for the output.
Initial Title
Wordpress Get Custom Post Type and Count posts for CSS Classes
Initial Tags
wordpress
Initial Language
PHP