WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Getting and showing chunk of html in widget (2 posts)

  1. ThorHammer
    Member
    Posted 1 year ago #

    Hello, I have copied an "empty" widget and tried to use this to get and display a large chunk of html in one of my sidebars. Upon activating the widget I get an error on this line:
    return get_file_contents('./inc/the_large_chunk.html');

    The entire code I added in the widget "shell" is here:

    function get_thelargechunk()
        {
            return get_file_contents('./inc/the_large_chunk.html');
    }
            if(foo == bar) {
                echo "nothing";
            }
             else {
                echo get_thelargechunck();
            }
  2. Rebecca Schaefer
    Member
    Posted 1 year ago #

    Unless this is a WP specific function that I haven't run across, you want to use file_get_contents(). That's the PHP function.

Topic Closed

This topic has been closed to new replies.

About this Topic