WordPress.org

Ready to get started?Download WordPress

Forums

PHP Code Widget
[resolved] HTML Include File (3 posts)

  1. FredG
    Member
    Posted 1 year ago #

    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/

  2. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 1 year ago #

    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.

  3. FredG
    Member
    Posted 1 year ago #

    Worked perfectly!

    thanks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.