Title: Styling templates help?
Last modified: August 19, 2016

---

# Styling templates help?

 *  [jas-](https://wordpress.org/support/users/jas-/)
 * (@jas-)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/styling-templates-help/)
 * I am new to wordpress but not so with css, html, php etc.
 * I am attempting to use the wp_get_recent_posts() function in order to loop over
   the posts and echo them out with customized class attributes.
 * Now I am certain this is not the most efficient method to use and am seeking 
   information on the best methods for applying specific styles. Currently some,
   not all of my div class attributes are being applied.
 * Here is my example. Any experienced theme developers know of a better way?
 *     ```
       <?php
        $recent_posts = wp_get_recent_posts(5);
        foreach($recent_posts as $post){
         echo '<div class="left-article">';
         echo '<a href="#"><img class="blog-img" src="images/aaalogo-min.png" alt="blogimg1" /></a>';
         echo '<div class="title"><a href="'.get_permalink($post['ID']).'">'.$post['post_title'].'</a></div>';
         echo '<div class="infobubble">Posted on '.$post['post_date'].'</div>'; // this class is not being applied
         echo '<div class="commentbubble"><a href="'.get_permalink($post['ID']).'#comments">'.$post['comment_count'].'</a></div>'; // this class is not being applied
         echo '</div>';
         echo '<div class ="content">';
         echo '<p class="blogarticle">'.$post['post_content'].'</p>';
         echo '<a href="'.get_permalink($post['ID']).'">Continue reading</a>'; // this class is not being applied
         echo '</div>';
        }
       ?>
       ```
   

The topic ‘Styling templates help?’ is closed to new replies.

 * 0 replies
 * 1 participant
 * Last reply from: [jas-](https://wordpress.org/support/users/jas-/)
 * Last activity: [15 years, 8 months ago](https://wordpress.org/support/topic/styling-templates-help/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
