Title: Passing variable through if statement with div
Last modified: August 30, 2016

---

# Passing variable through if statement with div

 *  Resolved [Osian Jones](https://wordpress.org/support/users/welshyoz/)
 * (@welshyoz)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/passing-variable-through-if-statement-with-div/)
 * I’m currently trying to add app store and google play buttons to my site. however
   I want the dives to load from a value that I have in Advanced Custom field.
 * I’ve managed to load them up with this code:
 *     ```
       <?php 
   
       $valueAppStore = get_field( "app_store_link" );
   
       $valueGooglePlay = get_field( "google_play_link");
       <div class="storeButtons"><a href="<?= $valueGooglePlay ?>" target="_blank"><img src="http://tafol.co.uk/images/google-cym.png" alt="Google Play" height="auto" width="200"></a><a href="<?= $valueAppStore?>"><img src="http://tafol.co.uk/images/app-store-cym.png" alt="App store" height="auto" width="200"></a>
       ?>
       ```
   
 * However, I want to load a different language .png when i switch languages so 
   I’ve used the if ICL_LANGUAGE_CODE to help me create this. My problem appears
   when I try to pass the variable in while it’s in an if-statement.
 * I’ve pasted what I have so far underneath. Please look at the 2nd language.
 * Any help would be appreciated greatly.
 *     ```
       <?php 
   
       $valueAppStore = get_field( "app_store_link" );
   
       $valueGooglePlay = get_field( "google_play_link");
   
        if (ICL_LANGUAGE_CODE == 'en')
       	{echo "english";}
        elseif(ICL_LANGUAGE_CODE == 'cy')
       	{echo "<div class='storeButtons'><a href="+ $valueGooglePlay +" target='_blank'><img src='http://tafol.co.uk/images/google-cym.png' alt='Google Play' height='auto' width='200'></a><a href="+ $valueAppStore +"><img src='http://tafol.co.uk/images/app-store-cym.png' alt='App store' height='auto' width='200'></a>
       ";}?>
       ```
   
 * Thanks in advance

Viewing 1 replies (of 1 total)

 *  Thread Starter [Osian Jones](https://wordpress.org/support/users/welshyoz/)
 * (@welshyoz)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/passing-variable-through-if-statement-with-div/#post-6683598)
 * resolved. turns out i needed to put .$valueGoolePlay. and not + $valueGooglePlay
   +

Viewing 1 replies (of 1 total)

The topic ‘Passing variable through if statement with div’ is closed to new replies.

## Tags

 * [variables](https://wordpress.org/support/topic-tag/variables/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [Osian Jones](https://wordpress.org/support/users/welshyoz/)
 * Last activity: [10 years, 6 months ago](https://wordpress.org/support/topic/passing-variable-through-if-statement-with-div/#post-6683598)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
