Hi i’m using the code below to call post from a certain Category under certain post types, But how do i style it so that i can make the first post different from the rest of the post.
<?php
$queryObject = new Wp_Query( array(
'showposts' => 4,
'post_type' => array('pretty-little-liars', 'revenge', 'once-upon-a-time'),
'category_name' => celebrity,
'orderby' => 1,
));
// The Loop!
if ($queryObject->have_posts()) {
?>
<?php
while ($queryObject->have_posts()){
$queryObject->the_post();
?>
<a href="<?php the_permalink(); ?>" title="<?php printf(__( 'Read %s', 'wpbx' ), wp_specialchars(get_the_title(), 1)) ?>">
<?php the_post_thumbnail('video-post'); ?>
</a>
<?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' ago'; ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<?php
}
?>
<?php wp_reset_postdata();
}
?>
You could check
current_post
in the loop:If you don’t mind a little extra markup, you could wrap the first post in a div + use its class to style this post differently.
You can do something like this: