Regarding to the performances, and the performances only (and not from the point of view of the readability of the code), is it a best practice to check if the post has a thumbnail before to check if we are on the front-page, the home page, a single page, etc. or to do the opposite ?
Will my website load faster if I write :
<?php
if ( has_post_thumbnail() ) {
if ( is_front_page() ) {
// Do something…
} elseif ( is_archive() ) {
// Do something…
} elseif ( is_page() ) {
// Do something…
} elseif ( is_single() ) {
// Do someting…
// And so on
}
} else {
// Do something…
}
?>
OR if I write :
if ( is_front_page() ) {
if ( has_post_thumbnail() ) {
// Do something…
} else {
// Do something…
}
}
if ( is_archive() ) {
if ( has_post_thumbnail() ) {
// Do something…
} else {
// Do something…
}
}
if ( is_page() ) {
if ( has_post_thumbnail() ) {
// Do something…
} else {
// Do something…
}
}
if ( is_single() ) {
if ( has_post_thumbnail() ) {
// Do something…
} else {
// Do something…
}
}
?>```