• Resolved snugabug

    (@cyberphonics)


    I need some step by step help here guys.

    I’ve been trying to figure out how to embed WordPress posts INTO a pre-existing website. All of the tutorials I’ve found, I’ve had trouble with because most want you to use PHP on a page with a .php extension which I don’t want. I want to incorporate the PHP into a .html page.

    I searched here (found this topic http://wordpress.org/support/topic/using-php-to-embed-wordpress-posts?replies=4) and other places for tutorials.

    The few tutorials I found that mention using PHP on an HTML page say that I need to add a few lines to an .htaccess file to tell the server to parse the PHP on that HTML page as if it was a PHP page. The problem is that they don’t say where to put it or what to do after you add it to make it work.

    I have Godaddy. I installed WordPress. I saw that it has an .htaccess file in the wordpress directory. I tried adding the lines the tutorials said to that. I also tried just creating a new .htaccess in the folder where the actual HTML file with the PHP inserted is located.

    In both cases, when I saved it and refreshed the HTML page, it gave me a 403 forbidden yada yada error. I Googled that and places said it’s either a permissions error or an .htaccess file blocking access but none of the places detailed how to fix that.

    Anyway, I started over entirely using this tutorial:
    http://www.corvidworks.com/articles/wordpress-content-on-other-pages

    Left as an html page, it showed a (read more) link so at least I’m getting farther because the PHP from the other tutorials I tried broke the page entirely lol When I changed it to a php page, I get this error:

    Warning: require(./wordpress/wp-load.php) [function.require]: failed to open stream: No such file or directory

    I can’t show you the website I’m working on so pretend it’s http://www.example.com. My first question is how am I supposed to link to the right directory as far as syntax goes? The tutorial says to start with this code:

    <?php
    // Include WordPress
    define('WP_USE_THEMES', false);
    require('./wordpress/wp-load.php');
    query_posts('showposts=1');
    ?>

    I kept my directory name as wordpress just until I can get the hang of this so it would be http://www.example.com/wordpress/wp-load.php. My HTML file I’m trying to insert the PHP into is in a different directory in http://www.example.com/other/blah.html.

    How do I write the syntax in the HTML page for it to point to the proper wp-load directory?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter snugabug

    (@cyberphonics)

    Yeah that’s one of the tutorials that didn’t help.

    Thread Starter snugabug

    (@cyberphonics)

    How am I supposed to write the link in the above code to get it to link to the proper place?

    Thread Starter snugabug

    (@cyberphonics)

    Ugh… I’ve been at this for two days and I’m starting to see why so many people don’t use wordpress. It may be “feature rich” and able to do “a lot” but what good is it if you can’t get it to do something very simple like display posts without having to be a programmer?

    I really wanted to use wordpress instead of tumblr, which makes embedding posts easy with one line of code, but if I can’t embed the posts seamlessly into my html page, it’s pointless. I don’t want to build my site around wordpress or have it on a standalone page skinned to mimic the rest of my site. I just want to display the posts.

    I’ll see if I can find someone who can help somewhere else and just post the answer here when I find it.

    Thread Starter snugabug

    (@cyberphonics)

    Solution found on Stackoverflow!

    They said that instead of using ./ to use the ../ in front of the path on the require line and that worked like a charm. Amazing it took two days for me to find someone who was able to answer something so simple lol

    Thanks everyone! Now I can move on to the good stuff lol

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Embed Posts in HTML Page’ is closed to new replies.