What is the correct way of embedding if else and elseif conditions inside html?
I recommend the following syntax for readability.
if ($condition): ?>
Content
elseif ($other_condition): ?>
Other Content
else: ?>
Default Content
endif; ?>
Note, omitting php on the open tags does require that short_open_tags is enabled in your configuration, which is the default. The relevant curly-brace-free conditional syntax is always enabled and can be used regardless of this directive.