Home › Forums › Back End › ID the Body Based on URL – WordPress/PHP › Re: ID the Body Based on URL – WordPress/PHP
November 26, 2010 at 7:53 am
#72174
Participant
Using OR statement there resets to a new instance of something for it to look at. So what you are saying is if get_curr_virtdir() == home or if solutions or if about-us or if partners .
Instead you should be asking the comparison over and over.
if get_curr_virtdir() == home or if get_curr_virtdir() == if solutions etc etc
|| get_curr_virtdir() == "solutions"
|| get_curr_virtdir() == "about-us"
|| get_curr_virtdir() == "partners"
|| get_curr_virtdir() == "contact-us" )
{
echo "navnews";
} else {
echo "navnewscurrent";
}?>
The reason it does that, although it seems long winded is what if you had another comparison?
get_curr_virtdir() == “home” || $garry == “Your Dad” || ….