There are no real correct order in which to use the conditionals. A general rule of thumb is to put the most used condition first and the least used last
I also think that a switch will be a bit better here as it will be bit faster. Normal else/if statements re-evalutes the statement before executing, where as switches doesn’t re-evalutes the conditions.
Just a note, is_archive()
will return true on all archives, so be careful with that. On the point on frontpages and blogpages, you can go and check this recent post I have done
The conditional is_main_query()
is not needed. It is basically just needed where something can influence the main query and custom queries like pre_get_posts
EDIT
A basic switch normally evaluates to true. If a condition evaluates to true, execution of the switch stops and the value is output from the switch. Here is a basic switch
switch ( true ) {
case (is_home() ):
$text="This is home";
break;
case ( is_category() ):
$text="This is a category page";
break;
case ( is_tag() ):
$text="This is a tag page";
break;
default:
$text="This is not home, category or tag pages";
break;
}
You can now output $text in your header like
echo $text;
This is just something simple and should give you a basic idea