Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End ID the Body Based on URL – WordPress/PHP Re: ID the Body Based on URL – WordPress/PHP

#72174
Rob MacKay
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” || ….