Title: Post Format, and Code
Last modified: August 20, 2016

---

# Post Format, and Code

 *  Resolved [3Plumes](https://wordpress.org/support/users/3plumes/)
 * (@3plumes)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/post-format-and-code/)
 * I’m having a bit of a problem adding the if, else statement to my loop so that
   I can display differently based on the post format. Can anyone see the error 
   in my code?
 *     ```
       <?php if (have_posts()) : ?>
                   <?php while (have_posts()) : the_post(); ?>
                       if ( has_post_format( 'status' )) {
                           <h3><a href="<?php echo get_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
                           <span class="postmeta">Published on <?php the_time('F jS, Y') ?> in <?php the_category(', ') ?></span>
       	                <?php the_content(); ?>
       	            }
                       else {
                           <h3><a href="<?php echo get_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
                           <span class="postmeta">Published on <?php the_time('F jS, Y') ?> in <?php the_category(', ') ?></span>
                           <?php the_excerpt(); ?>
                           <p><a href="<?php echo get_permalink(); ?>" title="Continue reading">Continue reading</a></p>
                       }
                   <?php endwhile; ?>
                   <?php else : ?>
                       Nothing Found Stuff goes here
                   <?php endif; ?>
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [David Sword](https://wordpress.org/support/users/davidsword/)
 * (@davidsword)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/post-format-and-code/#post-2566098)
 * at first glance: gotta wrap your PHP code in `<?php .. ?>` tags
 *     ```
       <?php if ( has_post_format( 'status' )) { ?>
       ```
   
 * …
 *     ```
       <?php }
                       else { ?>
       ```
   
 * …
 *     ```
       <?php } ?>
       ```
   
 *  Thread Starter [3Plumes](https://wordpress.org/support/users/3plumes/)
 * (@3plumes)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/post-format-and-code/#post-2566132)
 * Ahhh, thanks!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Post Format, and Code’ is closed to new replies.

 * 2 replies
 * 2 participants
 * Last reply from: [3Plumes](https://wordpress.org/support/users/3plumes/)
 * Last activity: [14 years, 3 months ago](https://wordpress.org/support/topic/post-format-and-code/#post-2566132)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
