Guys, I need to embed this html tags in my php code for my wordpress theme here is the html: <h1 class="pambungad"><?php _e('Welcome to', 'ad'); ?> <?php _e('Article Directory', 'ad')?></h1> Code (markup): and here is the php code: <?php if (is_home() ) { echo 'HERE' ;} else { echo 'Nothing to do here' ;} ?> Code (markup): I want the html code to be echo in 'HERE' but of course as you can see it won't work as I am using single and double quotes at the same time. Please help me. Thanks in advance and more power. Any kind of help s greatly appreciated.
<?php if( is_home() ) { printf('<h1 class="pambungad">%s %s</h1>', _e('Welcome to', 'ad'), _e('Article Directory', 'ad')); } PHP: http://www.php.net/manual/en/function.printf.php
<?php if (is_home() ) { echo "<h1 class='pambungad'><?php _e('Welcome to', 'ad'); ?> <?php _e('Article Directory', 'ad')?></h1>"; } else { echo 'Nothing to do here' ;} ?> PHP:
Sir, tried it but, the php were lost its inclusion in h1 tags. Sir, the _e('Welcome to', 'ad'), _e('Article Directory', 'ad' Code (markup): Should still be inside h1 tags. Sir, that is also my problem, it won't work because I am using double and single quote on my html. Thanks guys.
Did you actually try the line I code I provided, because it is altered to accommodate quotes. Are you getting any kind of error ?
Sir, yes sir, but the generated code is not enclosed in h1 tags. Actually, the h1 tag is not closed. It generates this: Welcome toArticle Directory<h1 class="pambungad"> </h1> Code (markup): thank you very much sir.