Hi! I am not a PHP guy but I know there is a better way to condense my hacked up little PHP snippet into something cleaner.
The context is that I want to get the value of a variable (total 4 values). Depending on the value, I want to display certain content. Below is my first stab (the context is WordPress).
<?php global $wp_query; ?>
<?php if (isset($wp_query->query_vars['inv'])) : ?>
<h1 style="color:#fff;">
<?php
if ($wp_query->query_vars['inv'] == 'yh') {
echo "Yahoo!";
}
?>
<?php
if ($wp_query->query_vars['inv'] == 'bg') {
echo "Bing Cosby Baby!";
}
?>
<?php
if ($wp_query->query_vars['inv'] == 'gg') {
echo "Google Bitch!";
}
?>
<?php
if ($wp_query->query_vars['inv'] == 'tp') {
echo "Third Party!";
}
?>
</h1>
<?php endif; ?>