How to “If is echo HTML / PHP / HTML”
-
I’m trying to IF IS some code that includes html/php/html. However, I’m having an issue.
The php is being displayed outside of, and BEFORE the first html. And the first html includes the div structure, so it’s breaking badly. The source code shows the order as – php/html/html.
The code block is as follows …..
<?php if ( is_home()) { echo '<div class="box">Welcome to ' . bloginfo('name') . ' website</div>' ; } elseif (is_single()) { echo '<div class="box">Single Page Message</div>' ; } else { echo '<div class="box">Generic Message</div>' ; } ?>I know where it’s going wrong, but I don’t know how to rectify it, or the correct ‘ ” echo protocol in such a case.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
The topic ‘How to “If is echo HTML / PHP / HTML”’ is closed to new replies.