wordpress – pull same blog data into multiple sites

I have a wordpress blog currently installed at blog.mydomain.com. I am creating a mobile version of my site at m.mydomain.com which will have a blog section. Obviously I want to use the same database and just pull in all the blog posts and display them with CSS customized for the mobile site. How can I accomplish this?

EDIT: Here is the code I’m trying to insert the blog posts into:

<div class="blog">
    <div class="section-header">
        <img class="section-logo" src="images/logo-small.png" alt="img">
        <a href="#" class="section-navigation-deploy"><img class="navigation-deploy-icon" src="images/nav-icon.png" alt="img"></a>
        <div class="clear"></div>
   </div>
   <div class="deco-open"></div>

   <?php
require('http://blog.mydomain.com/wp-blog-header.php');
$posts = get_posts('numberposts=-1&order=DSC&orderby=date');
?>

   <?php foreach ($posts as $post) : start_wp(); ?>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<section><?php the_excerpt(); ?></section>
<?php endforeach; ?>


    <div class="deco-close"></div>


</div>

Related posts

Leave a Reply

1 comment

  1. <?php
      require('./blog/wp-blog-header.php');
      $posts = get_posts('numberposts=-1&order=DSC&orderby=date');
    ?>
    

    The require should point to the wp-blog-header.php file in the root of your blog directory.

    This is the code I am currently using in wwwroot/index.php and my blog is in wwwroot/blog Once I get $posts I’ll display the contents with:

    <?php foreach ($posts as $post) : start_wp(); ?>
      <article>
        <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
        <section><?php the_excerpt(); ?></section>
      </article>
    <?php endforeach; ?>