Title: Conditionally alternate code
Last modified: August 20, 2016

---

# Conditionally alternate code

 *  [Myk Klemme](https://wordpress.org/support/users/mklemme/)
 * (@mklemme)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/conditionally-alternate-code/)
 * I’m creating my portfolio site with individual client pages that are broken into
   sections. Each section has two columns: content and an image/media/slider etc.
 * I have it setup that each section is only displayed if the tag is added. e.g.
   the mobile section on the page wont be displayed if the post isn’t tagged ‘mobile’.
 * The problem is that each section is hard coded. How can I have the section layout
   be conditional if it’s the first, second, etc. so all the images don’t fall on
   the right side.
 * Here’s my reference sandbox: mykklemme.com/Code/portfolio-single.html

Viewing 1 replies (of 1 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/conditionally-alternate-code/#post-2725244)
 * there are many ways to generate alternating stlyes in the loop; [example](http://www.transformationpowertools.com/wordpress/zebra-style-wordpress-loop)

Viewing 1 replies (of 1 total)

The topic ‘Conditionally alternate code’ is closed to new replies.

## Tags

 * [alternating](https://wordpress.org/support/topic-tag/alternating/)
 * [conditional](https://wordpress.org/support/topic-tag/conditional/)
 * [loop](https://wordpress.org/support/topic-tag/loop/)

 * 1 reply
 * 2 participants
 * Last reply from: [Michael](https://wordpress.org/support/users/alchymyth/)
 * Last activity: [13 years, 11 months ago](https://wordpress.org/support/topic/conditionally-alternate-code/#post-2725244)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
