Support » Fixing WordPress » Weird bug: WordPress auto convert PHP to HTML code

  • Resolved Tien Nguyen


    Dear all,

    I just install a new Centos server with Ngnix and php-fpm.

    Now, I am develop a template with my site at:
    But a weird error is when I code like below:

    <div class="blog-info">
    				<?php $fname = 'Blogger Items'; ?>
    				<?php if ( is_archive() ) : ?>
    					<h1 class="site-title"><?echo $fname;?></h1>
    				<?php else : ?>
    					<h2 class="site-title"><?echo $fname?></h2>
    				<?php endif; ?>
    				<p class="site-description"><?php bloginfo( 'description' ); ?></p>

    The output result will like below:

    <div class="blog-info">
    									<h2 class="site-title"><!--?echo $fname?--></h2>
    				<p class="site-description">Blogger and Blogspot Organization created amazing templates, widget, guide, tips, discussions and all free for you.</p>

    Mean <?echo $fname;?> in PHP will become <!--?echo $fname?--> in HTML
    This is WP bug or I am a noob?

    Appreciate all helps.

    Best regards,
    Tien Nguyen

Viewing 4 replies - 1 through 4 (of 4 total)
  • Looks like you probably dont have php shortcodes enabled so that php code that begins with “<?” is not recognised and therefore the code not executed. For example <? Echo $fname; ?>…

    In your php.ini file on your server, search for and then make sure the following line is set as follows, then restart your web server software:


    That should fix it.



    Or else , change all instances of <? to <?php


    Dear Ken,

    Thank for your suggestion, it’s working now. I found NGNIX can not process <?, you must use <?php.

    Best regards,



    you could try this php/js/smarty online formatting tool, if you get stuck

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Weird bug: WordPress auto convert PHP to HTML code’ is closed to new replies.