Last active
October 8, 2019 14:18
-
-
Save isotrope/d608857d08ba9a669754c0835aa6b9ff to your computer and use it in GitHub Desktop.
first-different.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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