Skip to content

Instantly share code, notes, and snippets.

@isotrope
Last active October 8, 2019 14:18
Show Gist options
  • Save isotrope/d608857d08ba9a669754c0835aa6b9ff to your computer and use it in GitHub Desktop.
Save isotrope/d608857d08ba9a669754c0835aa6b9ff to your computer and use it in GitHub Desktop.
first-different.php
<?php
$query_object = new Wp_Query( array(
'showposts' => 5,
'post_type' => array( 'post' ),
'category_name' => 'videos',
'orderby' => 1,
) );
// The Loop
if ( $query_object->have_posts() ) {
$i = 0;
while ( $query_object->have_posts() ) {
$query_object->the_post();
$post_class = $i == 0 ? 'first-post' : 'secondary-post';
?>
<div class="<?php echo esc_attr( $post_class ); ?>">
<a href="<?php the_permalink(); ?>" title="<?php printf( __( 'Read %s', 'wpbx' ), esc_attr( get_the_title() ) ) ?>">
<?php if ( $i == 0 ) {
the_post_thumbnail( 'sidethumbs' );
} else {
the_title();
} ?>
</a>
</div>
<?php
$i ++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment