mardi 22 mai 2018

PHP - If array contains

In wordpress i have an custom field where you can select multiple languages. Now I want to make an if statement so I can display flags for the selected languages.

For example the following languages are selected: NL, EN, DE, IT.

<?php if (in_array('nl', $languagevalue)) { ?>
    NL image
<?php } ?>

This works but I want to display a flags for each selected language. So if the array contains NL show NL-flag and if it also contains EN show EN-flag etc.

How can I achieve such thing?

Regards,

Aucun commentaire:

Enregistrer un commentaire