Title: Set class for get_post
Last modified: August 20, 2016

---

# Set class for get_post

 *  [imagebox](https://wordpress.org/support/users/imagebox/)
 * (@imagebox)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/set-class-for-get_post/)
 * Is it possible to set a css class specific to the last post returned with the
   get_post function? We have our ui li tags setup with a horizontal bar dividing
   each post. Without being able to set a class specific to the last post returned
   we end up with an unwanted horizontal
 *     ```
       <ul>
       <?php
       global $post;
       $args = array( 'numberposts' => 5, 'offset'=> 1, 'category' => 1 );
       $myposts = get_posts( $args );
       foreach( $myposts as $post ) :	setup_postdata($post); ?>
       	<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
       <?php endforeach; ?>
       </ul>
       ```
   

The topic ‘Set class for get_post’ is closed to new replies.

 * 0 replies
 * 1 participant
 * Last reply from: [imagebox](https://wordpress.org/support/users/imagebox/)
 * Last activity: [14 years, 11 months ago](https://wordpress.org/support/topic/set-class-for-get_post/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
