Link to home
Start Free TrialLog in
Avatar of RickEpnet
RickEpnetFlag for United States of America

asked on

Embed Wordpress Blog into my Web Site

I have a Web Site and PHP works fine on it and I have a Wordpress blog.

Path is as follows  websiteroot/blog

This is on a Windows server. The blog it self works fine
www.epnetworking.com/blog

I have a page like this but nothing shows up. Here is the test page. I found this code while search for a way to do this.
*****************Start Code************************
<html>
<head>
<title> PHP Test Script </title>
<?php require_once”./blog/wp-load.php”; ?>
</head>
<body>
<?php get_header();?> // Get the header of your new blog template

<?php query_posts(‘showposts=3');?> // You can set the number of post to show

<?php while (have_posts()): the_post(); ?>// The while loop to show the post

<h2><?php the_title(); ?></h2>// Show the title of the post…

<?php the_content();?>// Show the content of the post…

<?php endwhile; ?>// end of while loop

<?php
get_sidebar(); // Get the side bar of your blog template
get_footer(); // Get the footer of your blog template
?>
</body>
</html>
**********************End Code****************
Avatar of James Williams
James Williams
Flag of United States of America image

<?php
 require "../wp-load.php";
 ?>

Selvol
You can also do it with IFrame and the RSS Feed
Avatar of RickEpnet

ASKER

I would rather not use iframe and rss feeds I understand how to do that but I would rather use wp-load but I cannot seem to get it to work.

Selvol I tried this but it did not work. Where on the page should this code go. Head, body etc.?
<?php
 require "../wp-load.php";
 ?>
Assuming the page is on the top level of the site, try

<?php require_once ”blog/wp-load.php”; ?>
I get a blank page.

Here is the page
http://www.epnetworking.com/test.php

Here is my Blog
http://www.epnetworking.com/blog

Here is what is in test.php
******************************************
<html>
<head>
<title> PHP Test Script </title>
<?php require_once ”blog/wp-load.php”; ?>
</head>
<body>

</body>
</html>
******************************************
ASKER CERTIFIED SOLUTION
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks!!

It still did not work.

You can see at http://www.epnetworking.com/test.php

I pasted what you posted into the test.php

Could it be something to do with Wordpress?
Unlikely.

I just noticed that your original code block (which I modified) appears to have fancy quotes and that may screw things up.  Can you fix those to normal ' and " ?
Thank you so much the Quotes are what was wrong.
Heh.

Remember kids, don't use MS-WORD for code editing!

User generated image