Title: Multiple Installations
Last modified: August 19, 2016

---

# Multiple Installations

 *  [benhowdle89](https://wordpress.org/support/users/benhowdle89/)
 * (@benhowdle89)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/multiple-installations-4/)
 * Hi,
 * Just started using WordPress – really like it. What i’ve done is (and i dont 
   know if this was the best way to do it) using cPanel installed two instances 
   of WordPress, one to [http://www.example.com/blog](http://www.example.com/blog)
   and one two [http://www.example.com/articles](http://www.example.com/articles).
   I have a php homepage at [http://www.example.com](http://www.example.com), what
   i want to do is put the most recent blog post on the homepage and the most recent
   article post on the homepage. I got some code off another blog that has done 
   this for the blog installation but i cant work out how to do the same with the
   articles installation. the php code is `<?php
    // Include WordPress define(‘WP_USE_THEMES’,
   false); require(‘./blog/wp-load.php’); query_posts(‘showposts=1’); ?>`
 * and where i want the post is `<h2>Featured Blog Post</h2>
    <?php while (have_posts()):
   the_post(); ?> <a href=”<?php the_permalink(); ?>”><h3><?php the_title(); ?></
   h3></a> <?php the_excerpt(); ?> <?php endwhile; ?>`
 * so i need the same but for articles!
    Any help would be brilliant thanks!

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

 *  [jlevan](https://wordpress.org/support/users/jlevan/)
 * (@jlevan)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/multiple-installations-4/#post-1703521)
 * It looks to me that you are trying to do a bit too much work for what you are
   trying to accomplish.
 * It sounds like you just need one WordPress installation, and two parent categories.
 * I would install WP in a directory such as [http://example.com/wordpress](http://example.com/wordpress)–
   and set the blog URL to [http://example.com](http://example.com) – I believe 
   this is what you did for the original /blogs/ installation.
 * From there, create two main categories, blog and articles. In the WordPress settings,
   under Permalinks, set a custom permalink structure of `/%category%/%postname%/`
 * This will cause any posts in the blog category to have the URL of [http://example.com/blog/postname](http://example.com/blog/postname)
   and any post assigned to the category articles to have the URL structure of [http://example.com/articles/postname](http://example.com/articles/postname)
 * These articles should help:
    [http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory](http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory)
   [http://codex.wordpress.org/Using_Permalinks](http://codex.wordpress.org/Using_Permalinks)
 *  Thread Starter [benhowdle89](https://wordpress.org/support/users/benhowdle89/)
 * (@benhowdle89)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/multiple-installations-4/#post-1703522)
 * That def make more sense. So in regards to the PHP code i posted. My example.
   com isn’t a wordpress page at all, its just my sites homepage with menus and 
   images etc, so what code would i need to post the recent posts from each of blogs/
   articles?
 * Thanks
 *  [jlevan](https://wordpress.org/support/users/jlevan/)
 * (@jlevan)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/multiple-installations-4/#post-1703569)
 * Ok, sorry, I didn’t realize that the root already had a site built on it, I was
   assuming a fresh setup.
 * I’m unsure if my earlier advice would be the best in this case then. If the original
   page can be converted to a WordPress template page (you can set a static page
   as the homepage in the Settings -> Reading panel) that would make this a bit 
   easier, otherwise I am unsure about having the two categories located at /blog/
   and /articles/ respectively without causing an issue with your current homepage.
 * If you can integrate the pages currently located in the site root with WordPress,
   then to show a single post from multiple categories, I would try something like
   this:
 *     ```
       <?php  //store original query  ?>
       <?php $temp_query = $wp_query; ?>
   
       <?php // Display one item from 'blog' category ?>
       <?php query_posts('category_name=blog&posts_per_page=1'); ?>
       <?php while (have_posts()) : the_post(); ?>
         <h3> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
         <?php the_excerpt(); ?>
       <?php endwhile; ?>
   
       <?php // Display one item from 'articles' category ?>
       <?php query_posts('category_name=articles&posts_per_page=1'); ?>
       <?php while (have_posts()) : the_post(); ?>
         <h3> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
         <?php the_excerpt(); ?>
       <?php endwhile; ?>
   
       <?php // replace original query ?>
       <?php $wp_query = $temp_query; ?>
       ```
   
 * This should display 1 post from each of these categories, the code is modified
   from an example found here: [http://codex.wordpress.org/The_Loop#Multiple_Loops_Example_2](http://codex.wordpress.org/The_Loop#Multiple_Loops_Example_2)
 *  Thread Starter [benhowdle89](https://wordpress.org/support/users/benhowdle89/)
 * (@benhowdle89)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/multiple-installations-4/#post-1703573)
 * Perfect! Thanks so much!
 * Exactly what i wanted….

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

The topic ‘Multiple Installations’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [benhowdle89](https://wordpress.org/support/users/benhowdle89/)
 * Last activity: [15 years, 6 months ago](https://wordpress.org/support/topic/multiple-installations-4/#post-1703573)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
