WordPress.org

Ready to get started?Download WordPress

Forums

WordPress PHP in hello.html (4 posts)

  1. a4jp.com
    Member
    Posted 2 years ago #

    Do you know how to get something like the WordPress PHP code below working in a HTML file and not a file with a PHP extension? I know the PHP code works in a PHP file.

    <html>
    <head></head>
    <body>
    <?php
    require('http://agreatdream.com/wp-blog-header.php');
    ?>
    
    <?php
    	echo "You are here.";
    
      if (is_user_logged_in()){
    		echo "You are logged in.\n";
    	}
    	else {
    		echo "You are not logged in.\n";
    };
    ?>
    </body>
    </html>

    Glen

  2. JarretC
    Member
    Posted 2 years ago #

    You have to save the file as .php and not .html.

    Is there any particular reason you are wanting to use .html?

  3. Pankaj Pandey
    Member
    Posted 2 years ago #

    add below in your .htaccess
    AddType application/x-httpd-php .html

    also i suggest you need to change your include your wp-blog-header to relative to file not with http

    <?php
    require('../path/wp-blog-header.php');
    ?>
  4. Pankaj Pandey
    Member
    Posted 2 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic