Your first code sample didn’t work because the elseif
had no condition. elseif
is a concatenation of else
and if
:
if ( something ) {
} elseif ( something else ) {
} else {
}
Or
<?php if ( something ): ?>
<?php elseif ( something else ): ?>
<?php else: ?>
<?php endif; ?>
Also, if you want a front page that’s different from your other pages, look at the front-page.php
template.