Support » Plugins » Simple: Multiple sites with one WP

  • I thought of this shortly before going to sleep last night (literally flipped on the light and scribbled it down), dunno if it’s already been thought of (post a link if it has!), but it seemed like a good idea:
    To implement multiple sites/blogs in wordpress, perhaps we could use the already existing category framework?
    This is what I’m thinking: For each site’s respective index.php, set it up so that only “category” X is shown, where everything inside X is the content designated for that site.
    Here’s an example:
    Candles.com has the “Candles” and “Candle Information” categories shown on its page, while Jackets.org has everything inside the “Jackets” category, which includes the subcategories “Denim”, “Cotton”, and “Hoodie”. These two sites run completely independant of each other, but they both get their content from the same WP install.
    It’s worth noting that this concept can already be used on your own WordPress site, without any sort of manual modification to the code. However, you need to use this plugin to hide/show posts according to their category, as this functionality has not yet been introduced into WP’s template tag set (as of 1.2). There are likely several sites out there using this plugin in order to have some pages on their site show only the posts made for a certain category, such as having an “About me” page. However, this same concept could be used to create mini-blogs on one’s site, or even completely separate sites, using just one WP install (but multiple index.php’s, one for each site’s respective layout). I’ve done something along these lines for dividing up the content on my site, beoba.net, and there are probably dozens of other sites who have done similar things to theirs.
    However, this concept does not completely encompass the functionality that an administrator would want to have with multiple sites. Using the example given earlier, what if I had multiple users posting to WP, and I wanted to restrict them from posting to Candles.com, while still giving them access to Jackets.org? To do this, we need a way to restrict the user’s ability to post according to category. I’ve found this hack that should do just that, though I haven’t tried it myself just yet.
    So, with the combination of the “Show Categories” plugin and the “Category Restrictions” hack, we have an effective means of maintaining multiple sites using the same WP install, in a way that is both straightforward and that also wouldn’t be too difficult to implement into a future release of WP (hint).
    This has probably been thought of (and implemented) before, but a moderate amount of searching didn’t turn anything up, so here you go. This is more of a general overview of the concepts involved, if you want something more technical, say along the lines of a step-by-step, feel free to request and I’ll try to throw something together (once I’ve screwed around with the aforementioned hack). I’m hoping some of these functionalities can be added into a future release (especially a template tag showing/hiding posts according to category).
    Thanks for reading!

Viewing 5 replies - 1 through 5 (of 5 total)
  • I think this is the technique used by François Planque in his b2evolution, another branch of b2. See http://b2evolution.net/ for details. You could certainly download his application and examine the code to see how he’s worked out the creation and integration of multiple blogs.

    There are a couple of additional issues that I ran across while implementing something like this. The stock calendar and archive list functions do not provide a way to filter out categories — I put together a plugin for my own use that takes care of those, which can be found at http://www.qogo.com/wpplugins/ — get cats-widgets.php.txt (remove the .txt extension before use, of course)
    I think search has issues with category filtering as well, but I haven’t gotten to that yet.

    Thread Starter beoba

    (@beoba)

    I also noticed that there are some additional template files that would be shared between the two sites, such as the layout in wp-comments.php. However, if none of the sites needed any major modifications to that, then it’d work out fine.

    I implemented a different mechanism for multiple blogs that is based on sharing all of the files between the blogs – just not the database. It is simple to implement and works great: a brief description of how it works can be found here.

    Allan – I’m trying out your way now, it seems to be going well 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Simple: Multiple sites with one WP’ is closed to new replies.