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)
Viewing 1 replies (of 1 total)
The topic ‘Passing variable through if statement with div’ is closed to new replies.