Title: HTML Include File
Last modified: August 20, 2016

---

# HTML Include File

 *  Resolved [FredG](https://wordpress.org/support/users/fredg/)
 * (@fredg)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/html-include-file/)
 * I’m trying to display an HTML file if the user is not logged in. My code is:
 *     ```
       <?php
       if (is_user_logged_in()){
           echo "Welcome, registered user!";
       } else {
           echo "Welcome, visitor!";
           include("http://www.guytonsoftware.com/optionsmoneymaker/wp-content/themes/OMM Child/test.html");
       };
       ?>
       ```
   
 * I get the echo welcome messages, but the html file does not dsiplay. I can display
   the file in a browser using that URL.
 * thanks
 * [http://wordpress.org/extend/plugins/php-code-widget/](http://wordpress.org/extend/plugins/php-code-widget/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [13 years, 4 months ago](https://wordpress.org/support/topic/html-include-file/#post-3354330)
 * The include command is for including local files, not for including URLs. Most
   servers don’t allow URL fopen’s, so you can’t include a URL that way.
 * Try `include(ABSPATH.'/wp-content/themes/OMM Child/test.html');` instead.
 *  Thread Starter [FredG](https://wordpress.org/support/users/fredg/)
 * (@fredg)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/html-include-file/#post-3354363)
 * Worked perfectly!
 * thanks

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘HTML Include File’ is closed to new replies.

 * ![](https://ps.w.org/php-code-widget/assets/icon.svg?rev=992095)
 * [PHP Code Widget](https://wordpress.org/plugins/php-code-widget/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/php-code-widget/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/php-code-widget/)
 * [Active Topics](https://wordpress.org/support/plugin/php-code-widget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/php-code-widget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/php-code-widget/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [FredG](https://wordpress.org/support/users/fredg/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/html-include-file/#post-3354363)
 * Status: resolved