Is it possible to integrate WordPress content outside of WordPress install?

I have client that built a website that is part static html and part WordPress. The WordPress is only for the blog while the static pages are for the rest of the site content, including the home page.

This same client would like to be able to “pull” recent blog posts and comment counts from the blog and post them on the home page.

Read More

I am not familiar with WordPress, so I am posting this question to find out if this is even possible. If it is, I will naturally want to know “how?” but this is to get the ball rolling.

Any constructive feedback is welcome. Thanks!

Related posts

Leave a Reply

2 comments

  1. If you’re on a remote server, you could use WordPress’s built-in RSS or XMLRPC interfaces.

    If you’re on the same server, this snippet is tested against WP 2.7 but will probably work in 3.0 as well

    <?php
    
    
        $number = 5;
        $wordpress_header = "/path/to/wordpress/wp-blog-header.php";
    
              // Include wordpress header   
              if (file_exists($wordpress_header))
               {
                 include ($wordpress_header);
    
                $myposts = get_posts('numberposts=$number&offset=0&category=0');
    
                echo "<ul class='Bloglinks'>";
    
                foreach(array_slice($myposts, 0, $number) as $post) 
                 {
                    echo '<li><a href="';
                    the_permalink();
                    echo '">';
                    the_date();
                    echo " ";
                    the_title();
                    echo '</a></li>';
                 }
    
                 echo "</ul>";
    
               }
               else
               {
                 echo "Unable to connect to WordPress header file.";
                 die();
               }    
    
    
    ?>
    
  2. Sure you can fetch whatever you want from the wp database. There is a table posts with all the posts in it. Just connect thru it like you would any other database and query away!