Question: in my code below, I have the option to call one of the two custom fields (swf or swf2), depending on my need:

```
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

<?php if ( get_post_meta($post->ID, 'swf', true) ) { ?>

<?php $values = get_post_custom_values("swf"); echo $values[0]; ?>

<?php } else { ?>

<?php $values = get_post_custom_values("swf2"); echo $values[0]; ?>
<?php } ?>

<?php endwhile; else: ?>
<?php endif; ?>  

```

My question is, how do I add a third custom field(swf3)?
example:

```
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

<?php if ( get_post_meta($post->ID, 'swf', true) ) { ?>

<?php $values = get_post_custom_values("swf"); echo $values[0]; ?>

<?php } else { ?>

<?php $values = get_post_custom_values("swf2"); echo $values[0]; ?>

<?php } else { ?>

<?php $values = get_post_custom_values("swf3"); echo $values[0]; ?>
<?php } ?>

<?php endwhile; else: ?>
<?php endif; ?>  

```

When I add the custom field "swf3" I get a code error message.
How to fix this code?

Answer: 
There should be only one `else` in a `if` condition.

Your your code should be like this:

```
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <?php if ( get_post_meta($post->ID, 'swf', true) ) { ?>
        <?php $values = get_post_custom_values("swf"); echo $values[0]; ?>
    <?php } else if ( get_post_meta($post->ID, 'swf2', true) ) { ?>
        <?php $values = get_post_custom_values("swf2"); echo $values[0]; ?>
    <?php } else { ?>
        <?php $values = get_post_custom_values("swf3"); echo $values[0]; ?>
    <?php } ?>
<?php endwhile; else: ?>
<?php endif; ?>  

```
Change your code like this to make it work  

Use elseif in place of second else

```
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

<?php if ( get_post_meta($post->ID, 'swf', true) ) { ?>

<?php $values = get_post_custom_values("swf"); echo $values[0]; ?>

<?php } else if { ?>

<?php $values = get_post_custom_values("swf2"); echo $values[0]; ?>

<?php } else { ?>

<?php $values = get_post_custom_values("swf3"); echo $values[0]; ?>
<?php } ?>

<?php endwhile; else: ?>
<?php endif; ?>

```