• Is there a way to simply call the loop in any HTML file on the server (the same server that has the blog, of course)? It seems like this should be do-able, but I tried copying “theloop.php” into my page and it does not work.

    I want to be able to place my blog in the middle of my own HTML page–and not use the template to display it.

    The solutions I’ve read in here are all about bringing the blog into the page using RSS. That seems like it should be unnecessary, since all the code is there on my server.

    Any thoughts on this?

Viewing 5 replies - 1 through 5 (of 5 total)
  • no, especially when you are trying to do this inside an HTML page..

    HTML and files that end in .html ie, page.html are static.

    PHP and files that end in .php ie, page.php are dynamic.

    Consequently, you cannot just copy and paste PHP into an HTML page. Thats not how it works.

    All you have to do is rename the *.html page to *.php – assuming your host doesn’t have some restrictions that would make that impossible.

    i disagree, and thats begging for more questions in this thread.

    What does the loop.php have in it? Its not a core wp file so thats important to know. Does it call wp-blog-header.php? If it doesnt, it wont work. Is the path to wp-blog-header.php correct within it, assuming it IS calling it? If it isnt, it wont work.

    If it isnt calling wp-blog-header.php are the necessary functions included? If not, it wont work.

    One cannot just rename an HTML file to .php and expect it to work, and (no offense, V) that answer is too simplistic for his question.

    Well, no offense taken of course. But (leaving wp and the loop out of it for the moment), yes, you can simply rename an html file to php. (I do it all the time.) First he needs to find out if THAT’S an option with his host. It’s not with every host out there.

    THEN if it is, he can be guided as to things like calling wp-blog-header etc. in order to get the loop working. But first he needs to find out if his host will be okay with index.php instead of index.html or index.htm….

    Thread Starter vanburen

    (@vanburen)

    Well, according to my experiments, you are both right…sort of.

    You can rename between .htm and .php without a problem, but going from an HTML file to the index.php file is futile. WordPress will regenerate the code and rewrite the file each time it builds. So your original HTML will be replaced on the first re-build of the site.

    I have had some success in renaming php files to html and using them as static pages. There does not seem to be any problem with doing this.

    In summary, I think the answer to my question is this: there is no way to call “the loop” from within an html page. Anything I wanted to have appear on the HTML page has to be done through template modifications–so that WP can build the index.php page dynamically.

    I’ve had some luck accomplishing this wth template modifications. It just means getting more deeply into the templates than I wanted.

    Thanks for all your comments.

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

The topic ‘calling “the loop” in an HTML file’ is closed to new replies.